简体   繁体   中英

Get raw data from private repository

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM