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


Python HTTPClient.postForm方法代码示例

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


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

示例1: reportMemoryLeaks

# 需要导入模块: from pandac.PandaModules import HTTPClient [as 别名]
# 或者: from pandac.PandaModules.HTTPClient import postForm [as 别名]
def reportMemoryLeaks():
    if printUnreachableNum() == 0:
        return
    import bz2, gc
    gc.set_debug(gc.DEBUG_SAVEALL)
    gc.collect()
    uncompressedReport = ''
    for s in gc.garbage:
        try:
            uncompressedReport += str(s) + '&'
        except TypeError:
            pass

    reportdata = bz2.compress(uncompressedReport, 9)
    headers = {'Content-type': 'application/x-bzip2',
     'Accept': 'text/plain'}
    try:
        baseURL = patcherVer()[0].split('/lo')[0]
    except IndexError:
        print 'Base URL not available for leak submit'
        return

    basePort = 80
    if baseURL.count(':') == 2:
        basePort = baseURL[-4:]
        baseURL = baseURL[:-5]
    baseURL = baseURL[7:]
    if basePort != 80:
        finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    else:
        finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    reporthttp = HTTPClient()
    reporthttp.postForm(URLSpec(finalURL), reportdata)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:35,代码来源:UserFunnel.py

示例2: str

# 需要导入模块: from pandac.PandaModules import HTTPClient [as 别名]
# 或者: from pandac.PandaModules.HTTPClient import postForm [as 别名]
    except IndexError:
        print 'Base URL not available for leak submit'
        return None

    basePort = 80
    if baseURL.count(':') == 2:
        basePort = baseURL[-4:]
        baseURL = baseURL[:-5]
    
    baseURL = baseURL[7:]
    if basePort != 80:
        finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    else:
        finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    reporthttp = HTTPClient()
    reporthttp.postForm(URLSpec(finalURL), reportdata)


def checkParamFile():
    if os.path.exists('parameters.txt') == 1:
        paramfile = open('parameters.txt', 'r')
        contents = paramfile.read()
        paramfile.close()
        del paramfile
        contents = contents.split('\n')
        newURL = ''
        while contents:
            checkLine = contents.pop()
            if checkLine.find('PATCHER_BASE_URL=') != -1 and checkLine[0] == 'P':
                newURL = checkLine.split('=')[1]
                newURL = newURL.replace(' ', '')
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:33,代码来源:UserFunnel.py


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