Skip to main content

Conventions used at MicroPrediction.Org

Project description

getjson

Very limited mini-package for retrieving JSON data with backoff and failover

Install

pip install getjson 

Usage

data_or_none = getjson.getjson('https://config.microprediction.com/config.json')

This does one thing

def request_json(url, failover_url=None):
""" Tries to get json data from a URL for 30 seconds, then tries a failover url

    :param  url           str    e.g. 'https://config.microprediction.org/config.json'
    :param  failover_url  str    e.g. 'https://stableconfig.microprediction.org/config.json'
    :returns obj converted using json() method

    Does not throw exceptions. Fails quietly and returns None if data cannot be retrieved.

    If you don't like, use backoff directly.

"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getjson-0.1.1.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

getjson-0.1.1-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page