Created
November 19, 2015 19:14
-
-
Save rmoff/dc4494781a5813c48226 to your computer and use it in GitHub Desktop.
OBIEE Dashboard Prompt AJAX Response parser
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
#!/usr/bin/python | |
# @rmoff / November 19, 2015 | |
# | |
# Tested on OBIEE 11.1.1.7 | |
# | |
val="""OBIPS118s/L1GKZsNI0 | |
{t:4}8s/L1GKZsNI0{"VTColumnValues":{"currentPageInOptions":0,"moreOptions":false,"usedCustomValues":true,"querySql":"SELECT \"Offices\".\"D3 Organization\" saw_0 FROM \"A - Sample Sales\" ORDER BY saw_0\r\nFETCH FIRST 65001 ROWS ONLY\r\n","columnValues":[{"a":"Franchises Org.","c":0},{"a":"Inbound Org.","c":0},{"a":"International Org.","c":0},{"a":"Production Org.","c":0},{"a":"Subcontracted Org.","c":0},{"a":"Subsidiaries Org.","c":0}]}}""" | |
import json | |
json_raw = val.split('columnValues')[1][2:-2] | |
prompt_vals=json.loads(json_raw) | |
output_file=open('prompt.values.tsv','w') | |
for prompt in prompt_vals: | |
try: | |
parse="%s\t%s\n" % (prompt['b'],prompt['a']) | |
except: | |
try: | |
parse="%s\n" % (prompt['a']) | |
except: | |
print 'Could not parse %s' % prompt | |
output_file.write( parse) | |
print parse | |
output_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment