def get_rules(**kwargs):
    conf = config.resolve(kwargs)
    rules_url = _generate_rules_url(conf['url'])

    def fail(reason):
        raise RulesGetFailedException("Could not get current rules for '%s'. Reason: '%s'" % (rules_url, reason))

    try:
        r = requests.get(rules_url, auth=conf['auth'])
    except Exception as e:
        fail(str(e))

    if r.status_code not in range(200,300):
        fail("HTTP Status Code: %s" % r.status_code)

    try:
        rules_json = r.json()
    except:
        fail("GNIP API returned malformed JSON")

    if "rules" in rules_json:
        return rules_json['rules']
    else:
        fail("GNIP API response did not return a rules object")
Cyclone C{finish} handler
dataset/ETHPy150Open twitterdev/twitter-for-bigquery/libs/gnippy/rules.py/get_rules--crossover with--dataset/ETHPy150Open flaviogrossi/sockjs-cyclone/sockjs/cyclone/basehandler.py/BaseHandler.finish