本文整理汇总了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)
示例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(' ', '')