You need to use urllib.quote(YOUR_URL)
to escape the URL for HTTP. Remember to import urllib
.
Want to remove a space char in an API call where the query requires a space
Frage
I am attempting to use www.undata-api.org/ to gather UN Health data. However, if I use their call for getting the available data sets, I get a 404 error:u'Record does not exist'
GET http://api.undata-api.org/{organization}/{database}/database_datasets?app_id= {app_id}&app_key={app_key}
but the database name is 'WHO Data' -- it has a space in it, and so this call doesn't work. I looked around a bit and saw that people had suggested replacing the space with a '%20' or a +. Neither has worked for me.
I'm using urllib2 in python for this project.
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow