(url, headers=None, data=None)
return opener.open(request)
An URL opener with the User-agent set to gPodder (with version)
An URL opener with the User-agent set to gPodder (with version)
An URL opener with the User - agent set to gPodder ( with version )
def urlopen(url, headers=None, data=None):
    """
    An URL opener with the User-agent set to gPodder (with version)
    """
    username, password = username_password_from_url(url)
    if username is not None or password is not None:
        url = url_strip_authentication(url)
        password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
        password_mgr.add_password(None, url, username, password)
        handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
        opener = urllib.request.build_opener(handler)
    else:
        opener = urllib.request.build_opener()

    if headers is None:
        headers = {}
    else:
        headers = dict(headers)

    headers.update({"User-agent": settings.USER_AGENT})
    request = urllib.request.Request(url, data=data, headers=headers)
    return opener.open(request)
def urlopen ( url , headers = None , data = None ) : username , password = username_password_from_url ( url ) if username is not None or password is not None : url = url_strip_authentication ( url ) password_mgr = urllib . request . HTTPPasswordMgrWithDefaultRealm ( ) password_mgr . add_password ( None , url , username , password ) handler = urllib . request . HTTPBasicAuthHandler ( password_mgr ) opener = urllib . request . build_opener ( handler ) else : opener = urllib . request . build_opener ( ) if headers is None : headers = { } else : headers = dict ( headers ) headers . update ( { "User-agent" : settings . USER_AGENT } ) request = urllib . request . Request ( url , data = data , headers = headers ) return opener . open ( request )