]> apps.delaporte.us Git - dotfiles.git/blob - files/github.py
Remove spaces as they cause issues
[dotfiles.git] / files / github.py
1 """
2 Recently Updated Open GitHub Issues
3 """
4
5 import http.client
6
7 conn = http.client.HTTPSConnection("api.github.com")
8
9 payload = ""
10 token = open('./.github_access_token').read()
11 headers = { 'authorization': "token {}".format(token),
12 'User-Agent': 'Python Jupyter Notebook'}
13 conn.request("GET", "/issues?state=open&sort=updated", payload, headers)
14
15 res = conn.getresponse()
16 data = res.read()
17
18 results = data.decode("utf-8")
19
20 data_file = 'gh_open.json'
21 f = open(data_file, "w")
22 f.write(results)
23 f.close()
24 print("Updated {} with {} length".format(data_file, len(results)))
25
26 import pandas
27
28 pdata = pandas.read_json(data_file)
29 # print(pdata.title.head(3))
30
31 from simple_rest_client import api
32
33 token = open('./.github_access_token').read()
34 headers = { 'authorization': "token {}".format(token),
35 'User-Agent': 'Python Jupyter Notebook'}
36 gh = api.API(api_root_url="https://api.github.com", headers=headers,
37 append_slash=False,
38 json_encode_body=True)
39
40 gh.add_resource(resource_name='issues')
41 gh.issues.actions
42
43 results = gh.issues.list(params=query)
44 titles = list(map(lambda t : t["title"], results.body))
45
46 from simple_rest_client import api
47
48 token = open('./.github_access_token').read()
49 headers = { 'authorization': "token {}".format(token),
50 'User-Agent': 'Python Jupyter Notebook'}
51 gh = api.API(api_root_url="https://api.github.com", headers=headers,
52 append_slash=False,
53 json_encode_body=True)
54
55 gh.add_resource(resource_name='issues')
56 gh.issues.actions
57
58 titles = list(map(lambda t : t["title"], results.body))