I have a url that I need to add an api key as a parameter. The key has% and other characters in it and should not be encoded in the URL
It can not be true. It must be encoded in the URL. Otherwise, you will receive either an invalid URL or a URL that does not mean what you want.
, , 123%456%789. http://www.domain.com/service/?format=json&key=123%25456%25789, - 123%456%789, . http://www.domain.com/service/?format=json&key=123%456%789, - 123E6x9, .
, , .
- URL APP_KEY, ... , . , , , , URL- . , .
APP_KEY URL , , , urlparse.parse_qs, furl.
...
furl?
. . Encoding . furl .
. URL- , furl , , . README , furl('http://www.google.com/?one=1').add({'two':2}).url. , "key=123%25456%25789" -, , furl:
request_url = furl('http://www.domain.com/service/?key={}'.format(APP_KEY)) \
.add({
'format' : 'json',
'location' : address_line_1 + ',' + city + ',' + state,
}).url
Hacky? , , , furl, , , .