Post some text to a Gist, and return the URL.
(content, description='', filename='file', auth=False)
| 87 | requests.post(url, data=payload, headers=make_auth_header()) |
| 88 | |
| 89 | def post_gist(content, description='', filename='file', auth=False): |
| 90 | """Post some text to a Gist, and return the URL.""" |
| 91 | post_data = json.dumps({ |
| 92 | "description": description, |
| 93 | "public": True, |
| 94 | "files": { |
| 95 | filename: { |
| 96 | "content": content |
| 97 | } |
| 98 | } |
| 99 | }).encode('utf-8') |
| 100 | |
| 101 | headers = make_auth_header() if auth else {} |
| 102 | response = requests.post("https://api.github.com/gists", data=post_data, headers=headers) |
| 103 | response.raise_for_status() |
| 104 | response_data = json.loads(response.text) |
| 105 | return response_data['html_url'] |
| 106 | |
| 107 | def get_pull_request(project, num, auth=False): |
| 108 | """get pull request info by number |
nothing calls this directly
no test coverage detected