summaryrefslogtreecommitdiff
path: root/extras/appengine/static/sqlformat_client_example.py
blob: eec17b9693fe19fb9eca48728fb9a5c462559072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python

import urllib
import urllib2

REMOTE_API = 'http://sqlformat.appspot.com/format/'

payload = (
    ('data', 'select * from foo join bar on val1 = val2 where id = 123;'),
    ('format', 'text'),
    ('keyword_case', 'upper'),
    ('reindent', True),
    ('n_indents', 2),
    )

response = urllib2.urlopen(REMOTE_API,
                           urllib.urlencode(payload))
print response.read()