Permalink
Browse files

Take zip as the path as well as a query arg.

  • Loading branch information...
1 parent 25a0919 commit 3eea848a70114a0ef05fc4e63935b0539fa0f1fa Eric Shull committed Apr 11, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 zipapiserver.py
View
@@ -16,11 +16,15 @@ def do_GET(s):
# Get the zip from the data
qs = {}
path = s.path
+ the_zip = None
if '?' in path:
path, tmp = path.split('?', 1)
qs = urlparse.parse_qs(tmp)
the_zip = qs['zip']
+ elif path:
+ the_zip = [path.strip('/')]
+ if the_zip:
# Query database with the ZIP and pull the city, state, country
conn = sqlite3.connect('zipcodes.db')
c = conn.cursor()

0 comments on commit 3eea848

Please sign in to comment.