当前位置: 首页>>代码示例>>Python>>正文


Python FancyURLopener.__init__方法代码示例

本文整理汇总了Python中urllib.FancyURLopener.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FancyURLopener.__init__方法的具体用法?Python FancyURLopener.__init__怎么用?Python FancyURLopener.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在urllib.FancyURLopener的用法示例。


在下文中一共展示了FancyURLopener.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
	def __init__(self):
		try:
			context = ssl._create_unverified_context()
		except AttributeError:
			context = None

		FancyURLopener.__init__(self, context=context)
开发者ID:matevzv,项目名称:vesna-alh-tools,代码行数:9,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._last_url = u''
     FancyURLopener.__init__(self, *args, **kwargs)
     # Headers to add to every request.
     # XXX: IMDb's web server doesn't like urllib-based programs,
     #      so lets fake to be Mozilla.
     #      Wow!  I'm shocked by my total lack of ethic! <g>
     self.set_header('User-agent', 'Mozilla/5.0')
     # XXX: This class is used also to perform "Exact Primary
     #      [Title|Name]" searches, and so by default the cookie is set.
     c_header = 'id=%s; uu=%s' % (_cookie_id, _cookie_uu)
     self.set_header('Cookie', c_header)
开发者ID:conwetlab,项目名称:ezweb-gadgets,代码行数:14,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
    def __init__(self, ftpproxy=''):
        """RebaseUpdate([ftpproxy]]) -> new RebaseUpdate instance.

        if ftpproxy is not given RebaseUpdate uses the corresponding
        variable from RanaConfig.

        ftpproxy is the proxy to use if any.
        """
        proxy = {'ftp': ftpproxy or ftp_proxy}
        if not Rebase_name:
            raise FtpNameError('Rebase')
        if not proxy['ftp']:
            proxy = {}
        FancyURLopener.__init__(self, proxy)
开发者ID:Benjamin-Lee,项目名称:biopython,代码行数:16,代码来源:rebase_update.py

示例4: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._last_url = u""
     FancyURLopener.__init__(self, *args, **kwargs)
     # Headers to add to every request.
     # XXX: IMDb's web server doesn't like urllib-based programs,
     #      so lets fake to be Mozilla.
     #      Wow!  I'm shocked by my total lack of ethic! <g>
     for header in ("User-Agent", "User-agent", "user-agent"):
         self.del_header(header)
     self.set_header("User-Agent", "Mozilla/5.0")
     self.set_header("Accept-Language", "en-us,en;q=0.5")
     # XXX: This class is used also to perform "Exact Primary
     #      [Title|Name]" searches, and so by default the cookie is set.
     c_header = "uu=%s; id=%s" % (_cookie_uu, _cookie_id)
     self.set_header("Cookie", c_header)
开发者ID:Rickol91,项目名称:SickRage,代码行数:17,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        try: self.username = kwargs['username']
        except KeyError: self.username = None
        try: self.password = kwargs['password']
        except KeyError: self.password = None

        # once urllib uses new style classes, or in python 3.0+, use:
        # super(FancyURLopenerMod, self).__init__(*args, **kwargs)
        # till then this will work, but not in python 3.0+:
        FancyURLopener.__init__(self, *args, **kwargs)

        # only try opening the account once
        #self.authtries = 0
        #self.maxauthtries = 3

        self.flag = False
开发者ID:hrangan,项目名称:gmail.py,代码行数:18,代码来源:gmail.py

示例6: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
    def __init__(self, e_mail="", ftpproxy=""):
        """RebaseUpdate([e_mail[, ftpproxy]]) -> new RebaseUpdate instance.

        if e_mail and ftpproxy are not given RebaseUpdate uses the corresponding
        variable from RanaConfig.

        e_mail is the password for the anonymous ftp connection to Rebase.
        ftpproxy is the proxy to use if any."""
        proxy = {"ftp": ftpproxy or ftp_proxy}
        global Rebase_password
        Rebase_password = e_mail or Rebase_password
        if not Rebase_password:
            raise FtpPasswordError("Rebase")
        if not Rebase_name:
            raise FtpNameError("Rebase")
        FancyURLopener.__init__(self, proxy)
开发者ID:kaspermunch,项目名称:sap,代码行数:18,代码来源:Update.py

示例7: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self, username=None, passwd=None, *args, **kw):
     FancyURLopener.__init__( self, *args, **kw)
     self.username = username
     self.passwd = passwd
开发者ID:0xmilk,项目名称:appscale,代码行数:6,代码来源:URLopener.py

示例8: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self, user, passwd):
     self._user = user
     self._passwd = passwd
     self._promptcalled = False
     FancyURLopener.__init__(self)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:7,代码来源:net.py

示例9: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self):
     FancyURLopener.__init__(self)
开发者ID:dgingrich,项目名称:discogstagger,代码行数:4,代码来源:taggerutils.py

示例10: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self, user_agent):
     self.version = user_agent
     FancyURLopener.__init__(self)
开发者ID:triplem,项目名称:discogstagger,代码行数:5,代码来源:taggerutils.py

示例11: __init__

# 需要导入模块: from urllib import FancyURLopener [as 别名]
# 或者: from urllib.FancyURLopener import __init__ [as 别名]
 def __init__(self):
     FancyURLopener.__init__(self, proxies={})
开发者ID:Alwnikrotikz,项目名称:lh-abc,代码行数:4,代码来源:upnp.py


注:本文中的urllib.FancyURLopener.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。