Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132923 views
License: OTHER
1
#github_events.py
2
3
try:
4
from json import loads
5
6
import numpy as np
7
from requests import get
8
9
except ImportError as e:
10
raise e
11
12
13
URL = "https://api.github.com/events"
14
15
#github allows up to 10 pages of 30 events, but we will only keep the unique ones.
16
ids = np.empty(300, dtype=int)
17
18
k = 0
19
for page in range(10,0, -1):
20
21
r = get( URL, params = {"page":page} )
22
data = loads(r.text)
23
for event in data:
24
ids[k] = ( event["actor"]["id"] )
25
k+=1
26
27
ids = np.unique( ids.astype(int) )
28