Skip to content

Instantly share code, notes, and snippets.

@muzhig
Created May 16, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muzhig/5e166c0d2439b6ab40fcfe5389025c38 to your computer and use it in GitHub Desktop.
Save muzhig/5e166c0d2439b6ab40fcfe5389025c38 to your computer and use it in GitHub Desktop.
Fetch Rollbar Occurances via RQL
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