Skip to content

Instantly share code, notes, and snippets.

@pierrelux
Created August 18, 2015 19:48
Show Gist options
  • Save pierrelux/ce1202fe57bf32459b4b to your computer and use it in GitHub Desktop.
Save pierrelux/ce1202fe57bf32459b4b to your computer and use it in GitHub Desktop.
Query the list of available cars from Communauto's Auto-mobile service
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