question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Machine Learning with Python Projects - HTTP 403 from CDN

See original GitHub issue

Describe your problem and how to reproduce it: There seem to be issue with loading dataset from the cdn.freecodecamp.org when using get_file() function. The problem occurs only when both these conditions are fulfilled - using that function and when data is supposed to be downloaded from cdn.freecodecamp.org. So this currently applies only to Cat and Dog Image Classifier and Linear Regression Health Costs Calculator notebooks.

There’s no issue when dataset is downloaded alternatively - using wget as in Book Recommendation Engine using KNN notebook, or when dataset is not on cdn.freecodecamp.org as in Neural Network SMS Text Classifier.

When replacing downloading get_file() with the wget alternative in the affected notebooks datasets downloads fine.

fcc_cat_dog.ipynb

Downloading data from https://cdn.freecodecamp.org/project-data/cats-and-dogs/cats_and_dogs.zip
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
    262       try:
--> 263         urlretrieve(origin, fpath, dl_progress)
    264       except HTTPError as e:

8 frames
HTTPError: HTTP Error 403: Forbidden

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
    263         urlretrieve(origin, fpath, dl_progress)
    264       except HTTPError as e:
--> 265         raise Exception(error_msg.format(origin, e.code, e.msg))
    266       except URLError as e:
    267         raise Exception(error_msg.format(origin, e.errno, e.reason))

Exception: URL fetch failure on https://cdn.freecodecamp.org/project-data/cats-and-dogs/cats_and_dogs.zip: 403 -- Forbidden

fcc_predict_health_costs_with_regression.ipynb

Downloading data from https://cdn.freecodecamp.org/project-data/health-costs/insurance.csv
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
    262       try:
--> 263         urlretrieve(origin, fpath, dl_progress)
    264       except HTTPError as e:

8 frames
HTTPError: HTTP Error 403: Forbidden

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
    263         urlretrieve(origin, fpath, dl_progress)
    264       except HTTPError as e:
--> 265         raise Exception(error_msg.format(origin, e.code, e.msg))
    266       except URLError as e:
    267         raise Exception(error_msg.format(origin, e.errno, e.reason))

Exception: URL fetch failure on https://cdn.freecodecamp.org/project-data/health-costs/insurance.csv: 403 -- Forbidden

Add a Link to the page with the problem: https://www.freecodecamp.dev/learn/machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier https://colab.research.google.com/drive/1UCHiRuBLxo0S3aMuiDXlaP54LsxzrXHz https://www.freecodecamp.dev/learn/machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator https://colab.research.google.com/drive/1o8sTSCMa8Tnmcqhp_2BKKJEaHFoFmRzI?usp=sharing

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Machine Learning Python Help Please!
I just started the Cat and Dog classifier project on Python, but when I run the first part of the ... HTTPError: HTTP...
Read more >
Cloud Storage Errors and Error Handling - App Engine
This error (403) indicates that the user was not authorized by Google Cloud Storage to make the request. The various possible causes for...
Read more >
Problem HTTP error 403 in Python 3 Web Scraping
I was trying to scrape a website for practice, but I kept on getting the HTTP Error 403 (does it ...
Read more >
OSError: Tunnel connection failed: 403 Forbidden : Forums
From my pythonAnywhere app I send a get request to a external webserver and in the console i get following error message, see...
Read more >
Troubleshoot Azure Digital Twins: Error 403 (Forbidden)
This error may occur on many types of service requests that require authentication with Azure Digital Twins. The effect is that the API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found