MCPcopy Create free account
hub / github.com/ipython/ipython / post_gist

Function post_gist

tools/gh_api.py:89–105  ·  view source on GitHub ↗

Post some text to a Gist, and return the URL.

(content, description='', filename='file', auth=False)

Source from the content-addressed store, hash-verified

87 requests.post(url, data=payload, headers=make_auth_header())
88
89def 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
107def get_pull_request(project, num, auth=False):
108 """get pull request info by number

Callers

nothing calls this directly

Calls 1

make_auth_headerFunction · 0.85

Tested by

no test coverage detected