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


Python web.setupProxy函数代码示例

本文整理汇总了Python中psychopy.web.setupProxy函数的典型用法代码示例。如果您正苦于以下问题:Python setupProxy函数的具体用法?Python setupProxy怎么用?Python setupProxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: makeConnections

def makeConnections(app):
    """A helper function to be launched from a thread. Will setup proxies and check for updates.
    Should be run from a thread while the program continues to load.
    """
    if web.proxies is None:
        web.setupProxy()
    if web.proxies == 0:
        return
    if app.prefs.connections["allowUsageStats"]:
        sendUsageStats()
    if app.prefs.connections["checkForUpdates"]:
        app._latestAvailableVersion = getLatestVersionInfo()
开发者ID:harmadillo,项目名称:psychopy,代码行数:12,代码来源:connections.py

示例2: __init__

    def __init__(self,app=None, runningVersion=None):
        """The updater will check for updates and download/install them if necess.
        Several dialogs may be created as needed during the process.

        Usage::

            if app.prefs['AutoUpdate']:
                app.updates=Updater(app)
                app.updater.checkForUpdates()#if updates are found further dialogs will prompt
        """
        self.app=app
        if runningVersion==None:  self.runningVersion=psychopy.__version__
        else:  self.runningVersion=runningVersion

        #self.headers = {'User-Agent' : psychopy.constants.PSYCHOPY_USERAGENT}
        self.latest=None
        if web.proxies==None:
            web.setupProxy()
开发者ID:GentBinaku,项目名称:psychopy,代码行数:18,代码来源:connections.py

示例3: sendUsageStats

def sendUsageStats():
    """Sends anonymous, very basic usage stats to psychopy server:
      the version of PsychoPy
      the system used (platform and version)
      the date
    """

    v = psychopy.__version__
    dateNow = time.strftime("%Y-%m-%d_%H:%M")
    miscInfo = ''

    # urllib.install_opener(opener)
    # check for proxies
    if web.proxies is None:
        web.setupProxy()

    # get platform-specific info
    if sys.platform == 'darwin':
        OSXver, junk, architecture = platform.mac_ver()
        systemInfo = "OSX_%s_%s" % (OSXver, architecture)
    elif sys.platform.startswith('linux'):
        systemInfo = '%s_%s_%s' % (
            'Linux',
            ':'.join([x for x in platform.dist() if x != '']),
            platform.release())
    elif sys.platform == 'win32':
        ver = sys.getwindowsversion()
        if len(ver[4]) > 0:
            systemInfo = ("win32_v%i.%i.%i_%s" %
                          (ver[0], ver[1], ver[2], ver[4])).replace(' ', '')
        else:
            systemInfo = "win32_v%i.%i.%i" % (ver[0], ver[1], ver[2])
    else:
        systemInfo = platform.system() + platform.release()
    u = "http://www.psychopy.org/usage.php?date=%s&sys=%s&version=%s&misc=%s"
    URL = u % (dateNow, systemInfo, v, miscInfo)
    try:
        req = urllib.request.Request(URL)
        page = urllib.request.urlopen(req)  # proxies
    except Exception:
        logging.warning("Couldn't connect to psychopy.org\n"
                        "Check internet settings (and proxy "
                        "setting in PsychoPy Preferences.")
开发者ID:neuroidss,项目名称:psychopy,代码行数:43,代码来源:connections.py

示例4: test_setupProxy

 def test_setupProxy(self):
     web.getPacFiles()
     web.getWpadFiles()
     web.proxyFromPacFiles(web.getPacFiles(), log=False)
     web.setupProxy()
开发者ID:9173860,项目名称:psychopy,代码行数:5,代码来源:test_web.py


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