MCPcopy Create free account
hub / github.com/PyWavelets/pywt / __init__

Method __init__

util/gh_lists.py:128–144  ·  view source on GitHub ↗
(self, auth=False)

Source from the content-addressed store, hash-verified

126
127class GithubGet:
128 def __init__(self, auth=False):
129 self.headers = {'User-Agent': 'gh_lists.py',
130 'Accept': 'application/vnd.github.v3+json'}
131
132 if auth:
133 self.authenticate()
134
135 req = self.urlopen('https://api.github.com/rate_limit')
136 try:
137 if req.getcode() != 200:
138 raise RuntimeError()
139 info = json.loads(req.read().decode('utf-8'))
140 finally:
141 req.close()
142
143 self.ratelimit_remaining = int(info['rate']['remaining'])
144 self.ratelimit_reset = float(info['rate']['reset'])
145
146 def authenticate(self):
147 print("Input a Github API access token.\n"

Callers

nothing calls this directly

Calls 3

authenticateMethod · 0.95
urlopenMethod · 0.95
readMethod · 0.80

Tested by

no test coverage detected