summaryrefslogtreecommitdiff
path: root/extras/appengine/static/sqlformat_client_example.py
blob: 8b2a9e95ed38fff611eee8bd07b50a2a37c4c6b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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()