summaryrefslogtreecommitdiff
path: root/extras/appengine-django/static/sqlformat_client_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'extras/appengine-django/static/sqlformat_client_example.py')
-rw-r--r--extras/appengine-django/static/sqlformat_client_example.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/extras/appengine-django/static/sqlformat_client_example.py b/extras/appengine-django/static/sqlformat_client_example.py
new file mode 100644
index 0000000..eec17b9
--- /dev/null
+++ b/extras/appengine-django/static/sqlformat_client_example.py
@@ -0,0 +1,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()
+