github-api

Can someone give a python requests example of uploading a release asset in github?

梦想的初衷 提交于 2019-12-31 02:01:28
问题 url = 'https://github.abc.defcom/api/v3/repos/abc/def/releases/401/assets?name=foo.sh' r = requests.post(url, headers={'Content-Type':'application/binary'}, data=open('sometext.txt','r'), auth=('user','password')) This is giving me >>> r.text u'{"message":"Not Found","documentation_url":"https://developer.github.com/enterprise/2.4/v3"}' Where am I going wrong? 回答1: So I'll preface this with the advice that if you use a library it's as easy as: from github3 import GitHubEnterprise gh =

Search for code in GitHub using GraphQL (v4 API)

半腔热情 提交于 2019-12-30 03:48:07
问题 I am using the GitHub's GraphQL API to search for files/code containing a particular word. A simple (contrived) example of a search which in this case is to find the term "beef" in files located in "recipes" (the repo) for "someuser" (the owner for the repo) is shown below: { search(query: "beef repo:someuser/recipes", type: REPOSITORY, first: 10) { repositoryCount edges { node { ... on Repository { name } } } } } I tried this in GitHub's GraphQL Explorer (https://developer.github.com/v4

GitHub GraphQL equivalent of the contents API

青春壹個敷衍的年華 提交于 2019-12-29 16:07:21
问题 Does GitHub's GraphQL API have an equivalent to the contents API? I can't seem to come up with a query that accepts repo owner, repo name and file path and returns the contents of the file. I'm guessing it has something to do with the tree object? https://developer.github.com/early-access/graphql/explorer/ 回答1: After some digging, found it: query { repository(name: "repoName", owner: "repoOwner") { object(expression: "branch:path/to/file") { ... on Blob { text } } } } The argument passed to

Github API and Access-Control-Allow-Origin

风格不统一 提交于 2019-12-29 06:22:51
问题 this probably is a simple (series of) question(s) but I can't wrap my head around it. I'm trying to access the github api from a web app hosted on my site. This is the code in a nutshell: <!DOCTYPE html> <html> <head> <style>p { color:red; }</style> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function () { $.ajax( {url :'https://api.github.com/repos/janesconference/kievIIPlugins/commits', dataType: "json", cache: false, success: function (data,

Github v3 API - create a REPO

可紊 提交于 2019-12-28 12:44:10
问题 I’m trying to use the Github v3 API - I already implemented the required OAuth flow and it works well. Now I’m trying some of the Repos API endpoints (http://developer.github.com/v3/repos/). So far, I’m able to get a List of my repos using: GET /user/repos However, when I try to create a repo using POST /user/repos, I get a 404. Any thoughts what I might be doing wrong? Joubert 回答1: Can you please tell us how exactly you did the HTTP request? The 404 sounds like you were using a wrong path,

Is it possible to get commits history for one file in github api?

谁说我不能喝 提交于 2019-12-28 11:54:47
问题 I would like to get all commit messages for separate file in github REST api. But all I got - only to get all commits for separate branch. Then I tried to get following: http://api.github.com/users/<username>/<project>/commits/<branch>/<path/to/file> But that didn't help also. Is this at least possible? 回答1: Try this (as described in the API docs here): http://api.github.com/repos/:owner/:repo/commits?path=PATH_TO_FILE e.g. https://api.github.com/repos/izuzak/pmrpc/commits?path=README

How to create repository in github through github API?

有些话、适合烂在心里 提交于 2019-12-28 05:40:10
问题 I am trying to use github api to create repositories under a particular organization. I was looking at this site which talks about how to create repositories under a particular organization. Create a new repository in this organization. The authenticated user must be a member of the specified organization. POST /orgs/:org/repos Now I am not able to understand what will be my full URL that I need to use to create the repository under a particular organization? I have my username and password

400 Problems parsing JSON - GitHub API and POSTMAN using OAuth

扶醉桌前 提交于 2019-12-25 03:53:53
问题 I want to create a file in my private Repo via the GitHub API. https://developer.github.com/v3/repos/contents/#create-a-file PUT /repos/:owner/:repo/contents/:path I'm using Postman for testing and also already authorized via OAuth. https://api.github.com/repos/user/reponame/contents/test.txt?message=Myfirstmessage&content=SGVsbG8gV29ybGQgaW4gQmFzZTY0IQ== The error message is: "Problems parsing JSON" But where exactly is the problem? 回答1: I think you have to use choose file from body / binary

get all the sub file paths in a github repository

二次信任 提交于 2019-12-25 03:15:42
问题 I've been playing around with the github api (V3) recently. I would like to get a list of all files and sub files in the primary repo of the current commit. I can run https://api.github.com/repos/elasticsearch/elasticsearch/contents/ and send many more requests to crawl the directories. However the documentation mentions that I could use the tree api to get all the results. But https://api.github.com/repos/elasticsearch/elasticsearch/contents/?recursive=1 returns the same contents. Can I get

Get specific README.md data from Github API

回眸只為那壹抹淺笑 提交于 2019-12-24 19:29:57
问题 Recently, I started experimenting with the GitHub API getting specific data from public repos. Long story short, I want to grab specific parts of the README.md file from a repo. For example, the master branch from Facebook's react repository I want to grab the text under the Documentation header the GitHub API. Is this possible? Any methods of achieving this are welcome. Thank you! API : React README.md API Data Public Github URL: React public repo 回答1: There is no way to do this with the API