Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, json
- #Private map quest key used for authentication
- key = "Fmjtd%7Cluu8210zl1%2Cbl%3Do5-94rxdr"
- def urlBuilder(key):
- url = "http://open.mapquestapi.com/directions/v2/optimizedroute?key="
- url += key
- return url
- url = urlBuilder(key)
- masterRequest = {}
- request = []
- tempInput = {"street":"1455 Montreal Rd",
- "city":"Tucker",
- "county":"DeKalb",
- "state":"GA"}
- request.append(tempInput)
- tempInput2 = {"street":"495 Winn Way",
- "city":"Decatur",
- "county":"DeKalb",
- "state":"GA"}
- request.append(tempInput2)
- tempInput3 = {"street":"80 Jesse Hill Jr. Drive SE",
- "city":"Atlanta",
- "county":"Fulton",
- "state":"GA"}
- request.append(tempInput3)
- masterRequest["location"] = request
- inputJson = json.dumps(masterRequest, sort_keys = False)
- #print inputJson
- #inputJson = inputJson.replace(" ", "")
- #print inputJson
- #url += inputJson
- #print url
- print json.dumps(masterRequest, sort_keys = False, indent = 4, separators = (',', ': ')) #use for pretty printing
- #print "HERE IS CHARACTER 0: " + inputJson[0]
- #print inputJson[0]
- r = requests.post(url, json=inputJson)
- #print inputJson
- #print url
- #r = requests.get(url)
- print (r.url)
- print (r.content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement