Created
August 18, 2015 19:48
-
-
Save pierrelux/ce1202fe57bf32459b4b to your computer and use it in GitHub Desktop.
Query the list of available cars from Communauto's Auto-mobile service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
import urllib2 | |
import xml.etree.ElementTree as ET | |
def query_automobiles(): | |
url = 'https://www.reservauto.net/WCF/LSI/LSIBookingService.asmx/GetVehicleProposals?Callback=?' | |
values = {'CustomerID' : '""', | |
'Longitude' : '0', | |
'Latitude' : '0' } | |
headers = { 'Content-Type' : 'application/json; charset=utf-8', | |
'Accept': 'application/jsonp; charset=utf-8'} | |
data = urllib.urlencode(values) | |
req = urllib2.Request(url, data) | |
response = urllib2.urlopen(req) | |
return json.loads(ET.XML(response.read()).text[1:-2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment