in uber_rides/utils/request.py [0:0]
def build_url(host, path, params=None):
"""Build a URL.
This method encodes the parameters and adds them
to the end of the base URL, then adds scheme and hostname.
Parameters
host (str)
Base URL of the Uber Server that handles API calls.
path (str)
Target path to add to the host (e.g. 'v1.2/products').
params (dict)
Optional dictionary of parameters to add to the URL.
Returns
(str)
The fully formed URL.
"""
path = quote(path)
params = params or {}
if params:
path = '/{}?{}'.format(path, urlencode(params))
else:
path = '/{}'.format(path)
if not host.startswith(http.URL_SCHEME):
host = '{}{}'.format(http.URL_SCHEME, host)
return urljoin(host, path)