How to use the nvchecker.source.simple_json.simple_json 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 / nvchecker / source / cpan.py View on Github external
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg , et al.

from .simple_json import simple_json

# Using metacpan
CPAN_URL = 'https://fastapi.metacpan.org/release/%s'

def _version_from_json(data):
  return str(data['version'])

get_version, get_cacheable_conf = simple_json(
  CPAN_URL,
  'cpan',
  _version_from_json,
)
github lilydjwg / nvchecker / nvchecker / source / npm.py View on Github external
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg , et al.

from .simple_json import simple_json

NPM_URL = 'https://registry.npmjs.org/%s'

def _version_from_json(data):
  return data['dist-tags']['latest']

get_version, get_cacheable_conf = simple_json(
  NPM_URL,
  'npm',
  _version_from_json,
)
github lilydjwg / nvchecker / nvchecker / source / hackage.py View on Github external
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg , et al.

from .simple_json import simple_json

HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'

def _version_from_json(data):
  return data['normal-version'][0]

get_version, get_cacheable_conf = simple_json(
  HACKAGE_URL,
  'hackage',
  _version_from_json,
)
github lilydjwg / nvchecker / nvchecker / source / packagist.py View on Github external
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg , et al.

from .simple_json import simple_json

PACKAGIST_URL = 'https://packagist.org/packages/%s.json'

def _version_from_json(data):
  data = {version: details for version, details in data["package"]['versions'].items() if version != "dev-master"}

  if len(data):
    return max(data, key=lambda version: data[version]["time"])

get_version, get_cacheable_conf = simple_json(
  PACKAGIST_URL,
  'packagist',
  _version_from_json,
)
github lilydjwg / nvchecker / nvchecker / source / gems.py View on Github external
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg , et al.

from .simple_json import simple_json

GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'

def _version_from_json(data):
  return data[0]['number']

get_version, get_cacheable_conf = simple_json(
  GEMS_URL,
  'gems',
  _version_from_json,
)