File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,18 @@ class GitHub(object):
1919 rate_limit = None
2020 rate_left = None
2121 per_page = 30
22+ accept = 'application/vnd.github.v3+json'
2223
2324 def __init__ (self , apiurl = API_URL ):
2425 self .__basic_auth = None
2526
2627 def _get (self , * path ):
27- r = get ( * path , auth = self .__basic_auth )
28+ headers = { 'Accept' : self .accept }
2829
29- rate_limit = r .headers .get ('x-ratelimit-remaining' , None )
30- rate_left = r .headers .get ('x-ratelimit-limit' , None )
30+ r = get (* path , auth = self .__basic_auth , headers = headers )
31+
32+ rate_left = r .headers .get ('x-ratelimit-remaining' , None )
33+ rate_limit = r .headers .get ('x-ratelimit-limit' , None )
3134
3235 if (rate_limit is not None ) or (rate_left is not None ):
3336 self .rate_limit = rate_limit
@@ -48,7 +51,7 @@ def logged_in(self):
4851 r = self ._get ('' )
4952 print
5053
51- if r .status_code == 200 :
54+ if r .status_code == 200 and self . __basic_auth :
5255 return True
5356 else :
5457 return False
You can’t perform that action at this time.
0 commit comments