-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_settings.py
More file actions
41 lines (37 loc) · 905 Bytes
/
Copy pathrequest_settings.py
File metadata and controls
41 lines (37 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def get_token():
"""
get personal access token from .token
return None if no token found
"""
token = None
try:
with open(".token") as f:
token = f.read()
except IOError:
pass
return token
def get_PR_params(page = 1):
"""
create header for requests retrieving PRs
settings can be tweaked for different options
"""
return {
'state': 'all',
'sort': 'updated', # not sure if we're talking about creation date or last updated date
'direction': 'desc',
'per_page': '100',
'page' : str(page)
}
def token_header():
"""
return a general header for any githb api request
"""
token = get_token()
if token:
return {'Authorization': 'token %s' % token}
else:
return {}
"""
the maximum page of PRs one wishes to get
"""
DEFAULT_MAX_PAGE = float('inf')