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

import urllib
import urllib2

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('http://sqlformat.appspot.com/format/',
                           urllib.urlencode(payload))
print response.read()