def _generate_rules_url(url):
    if ".json" not in url:
        raise BadPowerTrackUrlException("Doesn't end with .json")
    if "stream.gnip.com" not in url:
        raise BadPowerTrackUrlException("Doesn't contain stream.gnip.com")

    return url.replace(".json", "/rules.json").replace("stream.gnip.com", "api.gnip.com")
Generate a rules URL from a PowerTrack URL
dataset/ETHPy150Open twitterdev/twitter-for-bigquery/libs/gnippy/rules.py/_generate_rules_url