How to use the Github API to get metadata on a repo #49744
Replies: 4 comments 3 replies
-
maybe this is issue? where is the space? for the backslash. |
Beta Was this translation helpful? Give feedback.
-
Here are some things to consider:
Here is an example Python script that should retrieve metadata on a private repository using the /repos/{owner}/{repo} endpoint: python import requests
Make sure to replace I hope this helps! Let me know if you have any further questions. |
Beta Was this translation helpful? Give feedback.
-
for anyone curious, the Python script I posted works, as well as Pasindu's. Just make sure to use a classic token instead of the fine-grained |
Beta Was this translation helpful? Give feedback.
-
@jhan-sims Hello I have the same problem, but even when I use a classic token I get error 404. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hi,
Not sure if this is too simple a question but I am quite new to API scripting.
I am trying to get metadata on a private repo using Github's API. I've tried three methods:
Windows CMD.
curl -H "Authorization: token [MY_TOKEN]" https://api.github.com/repos/OWNER/REPO
but this outputs "message": "Not Found"Python script.
but this only says Error: 404 - {"message":"Not Found" as well.
which outputs curl: (3) URL using bad/illegal format or missing URL
{
"message": "Bad credentials"
I'm sure I'm missing something simple, but if anyone knows how to use Github's API to retrieve metadata on a private repo please let me know.
Beta Was this translation helpful? Give feedback.
All reactions