Build a URL using Requests module Python

requests is basically a convenient wrapper around urllib (and 2,3 and other related libraries).

You can import urljoin(), quote() from requests.compat, but this is essentially the same as using them directly from urllib and urlparse modules:

>>> from requests.compat import urljoin, quote_plus
>>> url = "http://some-address.com/api/"
>>> term = 'This is a test'
>>> urljoin(url, quote_plus(term))
'http://some-address.com/api/This+is+a+test'

Leave a Comment