0

I want to download a zip file from my private repository from GitHub. Ths is my link to my private GitHub repository

https://raw.githubusercontent.com/<NAME>/Folder/master/dataset.zip?token=<TOKEN>

Unfortunately I get an HTTPError: HTTP Error 404: Not Found, so also in Python. Is there a option to get the raw data from my private GitHub repository ? I want to get access and download it in Python. I used a Personal access token for that.

# GitHub Access
file_url= ("https://raw.githubusercontent.com/<NAME>/Folder/master/dataset.zip?token=<TOKEN>")
zipped_file = keras.utils.get_file("dataset", file_url, extract=False)
print(zipped_file)

[OUT] HTTPError: HTTP Error 404: Not Found

# Normal Access
movielens_data_file_url = ("http://files.grouplens.org/datasets/movielens/ml-latest-small.zip")
movielens_zipped_file = keras.utils.get_file("ml-latest-small.zip", movielens_data_file_url, extract=False)
  • This could help : https://stackoverflow.com/questions/18126559/how-can-i-download-a-single-raw-file-from-a-private-github-repo-using-the-comman – AlexisG Sep 16 '20 at 13:38

1 Answers1

0

The URL you use now is.

https://raw.githubusercontent.com/<NAME>/Folder/master/dataset.zip?token=<TOKEN>

Take the token from the end and reformat your URL as follows:

https://<TOKEN>@raw.githubusercontent.com/<NAME>/Folder/master/dataset.zip

and try again.

BioGeek
  • 21,897
  • 23
  • 83
  • 145
  • Thanks for your comment. I don't know if it works, but keras gives me some erros. `Exception: URL fetch failure on https://@raw.githubusercontent.com///master/dataset_zip: None -- [Errno -2] Name or service not known` is it because the URL is wrong or is there another mistake? –  Sep 16 '20 at 13:55
  • It is this line `zipped_file = keras.utils.get_file("dataset", file_url, extract=False)` –  Sep 16 '20 at 13:57
  • And unfortunately the link also doesn't work in my browser. –  Sep 16 '20 at 13:59
  • Can you download the file with curl and the modified URL? See the command at the end of this article: https://dev.to/killdevils/github-download-a-file-from-a-private-repository-in-github-869 – BioGeek Sep 16 '20 at 14:00
  • And the you use is your personal access token, correct? – BioGeek Sep 16 '20 at 14:01
  • Yes I'm using the personal access token :) and now I can't download the file 404.. :( –  Sep 16 '20 at 14:03