本文整理汇总了Python中pandac.PandaModules.HTTPClient.getGlobalPtr方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPClient.getGlobalPtr方法的具体用法?Python HTTPClient.getGlobalPtr怎么用?Python HTTPClient.getGlobalPtr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.HTTPClient
的用法示例。
在下文中一共展示了HTTPClient.getGlobalPtr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: redownloadNews
# 需要导入模块: from pandac.PandaModules import HTTPClient [as 别名]
# 或者: from pandac.PandaModules.HTTPClient import getGlobalPtr [as 别名]
def redownloadNews(self):
if self.redownloadingNews:
self.notify.warning("averting potential crash redownloadNews called twice, just returning")
return
self.percentDownloaded = 0.0
self.notify.info("starting redownloadNews")
self.startRedownload = datetime.datetime.now()
self.redownloadingNews = True
self.addDownloadingTextTask()
for issue in self.issues:
issue.destroy()
self.issues = []
self.curIssueIndex = 0
self.strFilenames = None
self.needsParseNews = True
self.newsUrl = self.getInGameNewsUrl()
self.newsDir = Filename(self.findNewsDir())
Filename(self.newsDir + "/.").makeDir()
http = HTTPClient.getGlobalPtr()
self.url = self.newsUrl + self.NewsIndexFilename
self.ch = http.makeChannel(True)
self.ch.beginGetDocument(self.url)
self.rf = Ramfile()
self.ch.downloadToRam(self.rf)
taskMgr.remove(self.RedownloadTaskName)
taskMgr.add(self.downloadIndexTask, self.RedownloadTaskName)
return
示例2: ban
# 需要导入模块: from pandac.PandaModules import HTTPClient [as 别名]
# 或者: from pandac.PandaModules.HTTPClient import getGlobalPtr [as 别名]
def ban(self, avatarId, dislid, comment):
parameters = ''
parameters += 'app=%s' % self.App
parameters += '&product=%s' % self.Product
parameters += '&user_id=%s' % dislid
parameters += '&event_name=%s' % self.EventName
commentWithAvatarId = 'avId-%s ' % avatarId
commentWithAvatarId += comment
parameters += '&comments=%s' % urllib.quote(str(commentWithAvatarId))
baseUrlToUse = self.BanUrl
osBaseUrl = os.getenv('BAN_URL')
if osBaseUrl:
baseUrlToUse = osBaseUrl
fullUrl = baseUrlToUse + '?' + parameters
self.notify.info('ban request %s dislid=%s comment=%s fullUrl=%s' % (self.curBanRequestNum, dislid, comment, fullUrl))
simbase.air.writeServerEvent('ban_request', avatarId, '%s|%s|%s' % (dislid, comment, fullUrl))
if simbase.config.GetBool('do-actual-ban', True):
newTaskName = 'ban-task-%d' % self.curBanRequestNum
newTask = taskMgr.add(self.doBanUrlTask, newTaskName)
newTask.banRequestNum = self.curBanRequestNum
http = HTTPClient.getGlobalPtr()
channel = http.makeChannel(False)
self.channels[self.curBanRequestNum] = channel
rf = Ramfile()
self.ramFiles[self.curBanRequestNum] = rf
channel.beginGetDocument(fullUrl)
channel.downloadToRam(rf)
self.curBanRequestNum += 1
示例3: __init__
# 需要导入模块: from pandac.PandaModules import HTTPClient [as 别名]
# 或者: from pandac.PandaModules.HTTPClient import getGlobalPtr [as 别名]
def __init__(self, platform, hostDir, hostUrl):
self.platform = platform
self.hosts = {}
self.packages = {}
self.hostUrl = hostUrl
self.hostDir = Filename(hostDir)
self.hostDir.makeDir()
self.http = HTTPClient.getGlobalPtr()