Created
May 16, 2016 18:46
-
-
Save muzhig/5e166c0d2439b6ab40fcfe5389025c38 to your computer and use it in GitHub Desktop.
Fetch Rollbar Occurances via RQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def start_rql(rql, access_token): | |
base_url = 'https://api.rollbar.com' | |
start_job_url = base_url + '/api/1/rql/jobs?access_token=' + access_token | |
body = json.dumps({'query_string': rql}) | |
resp = requests.post(start_job_url, data=body, headers={'Content-Type': 'application/json'}).json() | |
get_job_res = '{}/api/1/rql/job/{}?access_token={}&expand=result'.format(base_url, resp['result']['id'], access_token) | |
def getter(): | |
return requests.get(get_job_res).json()['result']['result']['rows'] | |
return getter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment