import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse
import json
import sys

print(sys.argv)

api_key, userip = None, None
query = {'q' : 'great climbing in new york'}

# by default, you learn about climbing, but if you give an argument, you learn
# about other stuff.
if 1 < len(sys.argv):
    query['q'] = sys.argv[1]

url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % (
    urllib.parse.urlencode(query))

request = urllib.request.Request(url)
print (urllib.request.urlopen(request))
