Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
github = xxx
''')
f.flush()
test_conf = '''\
[example]
github = harry-sanabria/ReleaseTestRepo
[__config__]
keyfile = {name}
'''.format(name=f.name)
try:
version = await run_source(test_conf, clear_cache=True)
assert version is None # out of allowance
return
except HTTPError as e:
assert e.code == 401
return
raise Exception('expected 401 response')
async def get_version(name, conf, **kwargs):
try:
return await get_version_real(name, conf, **kwargs)
except HTTPError as e:
check_ratelimit(e, name)
async def get_version(name, conf, **kwargs):
try:
return await get_version_real(name, conf, **kwargs)
except HTTPError as e:
check_ratelimit(e, name)
def filter_exc(logger, level, event):
exc_info = event.get('exc_info')
if not exc_info:
return event
if exc_info is True:
exc = sys.exc_info()[1]
else:
exc = exc_info
if isinstance(exc, HTTPError):
if exc.code == 599: # tornado timeout
del event['exc_info']
elif isinstance(exc, NetworkErrors):
del event['exc_info']
event['error'] = exc
return event