How to use the nvchecker.source.HTTPError function in nvchecker

To help you get started, we’ve selected a few nvchecker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lilydjwg / nvchecker / tests / test_keyfile.py View on Github external
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')
github lilydjwg / nvchecker / nvchecker / source / github.py View on Github external
async def get_version(name, conf, **kwargs):
  try:
    return await get_version_real(name, conf, **kwargs)
  except HTTPError as e:
    check_ratelimit(e, name)
github lilydjwg / nvchecker / nvchecker / source / gitlab.py View on Github external
async def get_version(name, conf, **kwargs):
  try:
    return await get_version_real(name, conf, **kwargs)
  except HTTPError as e:
    check_ratelimit(e, name)
github lilydjwg / nvchecker / nvchecker / slogconf.py View on Github external
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