

def _fetch_remote(service_url, params={
    
}, use_http_post=False):
    encoded_data = {
        
    }
    for (k, v) in params.items():
        if isinstance(v, six.string_types):
            v = v.encode('utf-8')
        encoded_data[k] = v
    encoded_data = urllib.parse.urlencode(encoded_data)
    if (not use_http_post):
        query_url = (service_url if service_url.endswith('?') else ('%s?' % service_url))
        request_url = (query_url + encoded_data)
        request = urllib.request.Request(request_url)
    else:
        request_url = service_url
        request = urllib.request.Request(service_url, data=encoded_data)
    return (request_url, urllib.request.urlopen(request))

dataset/ETHPy150Open slimkrazy/python-google-places/googleplaces/__init__.py _fetch_remote/original