Skip to content

Commit

Permalink
Fix issue where country isn't working right.
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed May 15, 2012
1 parent 2d361c1 commit 349db73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zipapiserver.py
Expand Up @@ -45,7 +45,13 @@ def do_GET(s):
# Query database with the ZIP and pull the city, state, country
conn = sqlite3.connect(database_name)
c = conn.cursor()
c.execute("SELECT Country, State, City from zipcodes WHERE zipcode LIKE ?", the_zip)

if the_country is not None:
print the_country
print the_zip
c.execute("SELECT Country, State, City from zipcodes WHERE zipcode LIKE ? AND country LIKE ?", (the_zip[0], the_country))
else:
c.execute("SELECT Country, State, City from zipcodes WHERE zipcode LIKE ?", the_zip)

row = c.fetchone()

Expand Down

0 comments on commit 349db73

Please sign in to comment.