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


Python PandaModules.HTTPClient类代码示例

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


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

示例1: getFunnelURL

    def getFunnelURL(self):
        if patcherVer() == ['OFFLINE']:
            return
        if patcherVer() == []:
            patcherHTTP = HTTPClient()
            if checkParamFile() == None:
                patcherDoc = patcherHTTP.getDocument(URLSpec('http://download.toontown.com/english/currentVersion/content/patcher.ver'))
                vconGroup('w', self.cgRelease)
            else:
                patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile()))
                vconGroup('w', self.cgBeta)
            rf = Ramfile()
            patcherDoc.downloadToRam(rf)
            self.patcherURL = rf.getData()
            if self.patcherURL.find('FUNNEL_LOG') == -1:
                patcherVer('w', 'OFFLINE')
                return
            self.patcherURL = self.patcherURL.split('\n')
            del rf
            del patcherDoc
            del patcherHTTP
            while self.patcherURL:
                self.confLine = self.patcherURL.pop()
                if self.confLine.find('FUNNEL_LOG=') != -1 and self.confLine.find('#FUNNEL_LOG=') == -1:
                    self.dynamicVRFunnel = self.confLine[11:].strip('\n')
                    patcherVer('w', self.confLine[11:].strip('\n'))

        else:
            self.dynamicVRFunnel = patcherVer()[0]
        return
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:30,代码来源:UserFunnel.py

示例2: reportMemoryLeaks

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,代码行数:33,代码来源:UserFunnel.py

示例3: ban

 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
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:30,代码来源:BanManagerAI.py

示例4: redownloadNews

    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
开发者ID:TLOTT-PS,项目名称:ttr-src,代码行数:28,代码来源:DirectNewsFrame.py

示例5: __init__

 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()
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:8,代码来源:DeploymentTools.py

示例6: _LoadingScreen__setAdArt

 def _LoadingScreen__setAdArt(self):
     imageFrame = self.model.find('**/frame')
     randomImageNumber = random.randint(0, len(screenShots) - 1)
     imageFileName = screenShots[randomImageNumber]
     self.adImage = loader.loadModel(imageFileName)
     self.adImage.reparentTo(imageFrame)
     self.adImage.setScale(2.1499999999999999 * 5, 1, 1.2 * 5)
     self.adImage.setPos(0, 0, 2.2999999999999998)
     self.adImage.setBin('fixed', 1)
     if randomImageNumber == 0:
         urlToGet = 'http://log.go.com/log?srvc=dis&guid=951C36F8-3ACD-4EB2-9F02-8E8A0A217AF5&drop=0&addata=3232:64675:408091:64675&a=0'
         self.httpSession = HTTPClient()
         self.nonBlockHTTP = self.httpSession.makeChannel(False)
         self.nonBlockHTTP.beginGetDocument(DocumentSpec(urlToGet))
         instanceMarker = 'FunnelLoggingRequest-%s' % str(random.randint(1, 1000))
         self.startCheckingAsyncRequest(instanceMarker)
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:16,代码来源:LoadingScreen.py

示例7: Heartbeat

class Heartbeat():
    
    def __init__(self):
        self.http = HTTPClient()
        
        self.SendHeartbeat()
        #taskMgr.doMethodLater(10, self.SendHeartbeat, 'SendHeartbeat')
        
    def SendHeartbeat(self, task = None):
        baseUrl = 'http://modifire.net/heartbeat.php?'
        values = {'name' : Settings.SERVER_NAME,
                  'currentPlayers' : Globals.CURRENT_PLAYERS,
                  'maxPlayers' : Globals.MAX_PLAYERS,
                  'public' : Settings.SERVER_PUBLIC,
                  'port' : Globals.PORT_SERVER_LISTENER,
                  'version' : Globals.VERSION}
        
        for key, value in values.iteritems():
            values[key] = urllib.quote(str(value))
        
        params = [
                  baseUrl,
                  'name=%s' % (values['name']),
                  'currentPlayers=%s' % (values['currentPlayers']),
                  'maxPlayers=%s' % (values['maxPlayers']),
                  'public=%s' % (values['public']),
                  'port=%s' % (values['port']),
                  'version=%s' % (values['version'])
                  ]
        
        req = '&'.join(params)
        self.channel = self.http.makeChannel(True)
        self.channel.beginGetDocument(DocumentSpec(req))
        self.rf = Ramfile()
        self.channel.downloadToRam(self.rf)
        taskMgr.add(self.downloadTask, 'download')
        
        if(task):
            return task.again
         
    def downloadTask(self, task):
        if self.channel.run():
            return task.cont
        if not self.channel.isDownloadComplete():
            return task.done
        data = self.rf.getData()
        return task.done
开发者ID:czorn,项目名称:Modifire,代码行数:47,代码来源:Heartbeat.py

示例8: __init__

 def __init__(self):
     self.hitboxAcct = 'DM53030620EW'
     self.language = 'en-us'
     self.cgRoot = 'ToonTown_Online'
     self.cgBeta = 'Beta'
     self.cgRelease = 'Release'
     self.cgLocation = 'US'
     self.campaignID = ''
     self.cfCookieFile = 'cf.txt'
     self.dynamicVRFunnel = 'http://download.toontown.com/'
     self.hostDict = {0: 'Internal Disney PHP Collector Site',
      1: 'ehg-dig.hitbox.com/HG?',
      2: 'ehg-dig.hitbox.com/HG?',
      3: 'build64.online.disney.com:5020/index.php?'}
     self.CurrentHost = ''
     self.URLtoSend = ''
     self.gameName = 'ToonTown'
     self.browserName = 'Panda3D%20(' + self.gameName + ';%20' + sys.platform + ')'
     self.HTTPUserHeader = [('User-agent', 'Panda3D')]
     self.osMajorver = ''
     self.osMinorver = ''
     self.osRevver = ''
     self.osBuild = ''
     self.osType = ''
     self.osComments = ''
     self.msWinTypeDict = {0: 'Win32s on Windows 3.1',
      1: 'Windows 95/98/ME',
      2: 'Windows NT/2000/XP',
      3: 'Windows CE'}
     self.milestoneDict = {0: 'New User',
      1: 'Create Account',
      2: 'View EULA',
      3: 'Accept EULA',
      4: 'Download Start',
      5: 'Download End',
      6: 'Installer Run',
      7: 'Launcher Start',
      8: 'Launcher Login',
      9: 'Client Opens',
      10: 'Create Pirate Loads',
      11: 'Create Pirate Exit',
      12: 'Cutscene One Start',
      13: 'Cutscene One Ends',
      14: 'Cutscene Two Start',
      15: 'Cutscene Thee Start',
      16: 'Cutscene Three Ends',
      17: 'Access Cannon',
      18: 'Cutscene Four Starts',
      19: 'Cutscene Four Ends',
      20: 'Dock - Start Game'}
     self.macTypeDict = {2: 'Jaguar',
      1: 'Puma',
      3: 'Panther',
      4: 'Tiger',
      5: 'Lepard'}
     self.milestone = ''
     self.pandaHTTPClientVarWSS = []
     self.pandaHTTPClientVarCTG = []
     self.pandaHTTPClientVarDM = []
     self.checkForCFfile()
     self.httpSession = HTTPClient()
     self.whatOSver()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:62,代码来源:UserFunnel.py

示例9: LoadingScreen


#.........这里部分代码省略.........
        
        if len(targetName):
            self._LoadingScreen__setLocationText(targetName)

    def setLoadingScreenShot(self, screenshot):
        if not screenshot:
            return

        self._LoadingScreen__setLoadingArt(screenshot)
    
    def _LoadingScreen__setLoadingArt(self, screenshot):
        if self.snapshot:
            return None
        
        if self.parent and hasattr(base, 'localAvatar') and base.localAvatar.style.getTutorial() < PiratesGlobals.TUT_MET_JOLLY_ROGER and screenshot not in tutorialShots:
            screenshot = random.choice(tutorialShots)
        
        self.snapshot = loader.loadModel(screenshot)
        if self.snapshot:
            if self.parent and base.cr.isPaid() == OTPGlobals.AccessVelvetRope and base.config.GetBool('loading-screen-interstitial', 0):
                self.snapshot.setScale(2.3500000000000001, 1.0, 1.3)
                self.snapshot.setPos(-3.7400000000000002, 0, -1.8300000000000001)
                if self.model is not None:
                    root = self.model.find('**/loading_screen_top')
                    frame_little = self.model.find('**/frame_little')
                    self.snapshot.reparentTo(root, 0)
                    frame_little.reparentTo(root, 1)
                
            else:
                self.snapshot.reparentTo(aspect2dp, NO_FADE_SORT_INDEX)
                self.snapshot.setScale(2.1499999999999999, 1, 1.2)
                self.snapshot.setPos(0.0, 0.0, 0.089999999999999997)
                self.snapshot.setBin('fixed', 1)
            if not self._LoadingScreen__isVisible():
                self.snapshot.hide()
            
        

    
    def _LoadingScreen__setLocationText(self, locationText):
        self.locationText = locationText
        if self._LoadingScreen__isVisible():
            self.locationLabel['text'] = locationText
            self.locationLabel.show()
            self.showTitleFrame()
        
        launcher.setValue('gameLocation', self.locationText)

    
    def _LoadingScreen__setHintText(self, hintText):
        self.hintText = hintText
        if self._LoadingScreen__isVisible():
            self.hintLabel['text'] = hintText
            self.hintLabel.show()
        

    
    def _LoadingScreen__isVisible(self):
        return self.state

    
    def scheduleHide(self, function):
        base.cr.queueAllInterestsCompleteEvent()
        self.acceptOnce(function, self.hide)

    
    def _LoadingScreen__setAdArt(self):
        imageFrame = self.model.find('**/frame')
        randomImageNumber = random.randint(0, len(screenShots) - 1)
        imageFileName = screenShots[randomImageNumber]
        self.adImage = loader.loadModel(imageFileName)
        self.adImage.reparentTo(imageFrame)
        self.adImage.setScale(2.1499999999999999 * 5, 1, 1.2 * 5)
        self.adImage.setPos(0, 0, 2.2999999999999998)
        self.adImage.setBin('fixed', 1)
        if randomImageNumber == 0:
            urlToGet = 'http://log.go.com/log?srvc=dis&guid=951C36F8-3ACD-4EB2-9F02-8E8A0A217AF5&drop=0&addata=3232:64675:408091:64675&a=0'
            self.httpSession = HTTPClient()
            self.nonBlockHTTP = self.httpSession.makeChannel(False)
            self.nonBlockHTTP.beginGetDocument(DocumentSpec(urlToGet))
            instanceMarker = 'FunnelLoggingRequest-%s' % str(random.randint(1, 1000))
            self.startCheckingAsyncRequest(instanceMarker)
        

    
    def startCheckingAsyncRequest(self, name):
        taskMgr.remove(name)
        taskMgr.doMethodLater(0.5, self.pollAdTask, name)

    
    def pollAdTask(self, task):
        result = self.nonBlockHTTP.run()
        if result == 0:
            self.stopCheckingAdTask(task)
        else:
            return Task.again

    
    def stopCheckingAdTask(self, name):
        taskMgr.remove(name)
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:101,代码来源:LoadingScreen.py

示例10: __init__

class UserFunnel:

    def __init__(self):
        self.hitboxAcct = 'DM560804E8WD'
        self.omniAccount = 'wdgdolpironl,wdgdsec'
        self.language = 'en-us'
        self.cgRoot = 'Pirates_Online'
        self.cgBeta = 'Beta'
        self.cgRelease = 'Release'
        self.cgLocation = 'US'
        self.ogBeta = 'pir_onl_beta'
        self.ogRelease = 'pir_onl'
        self.ogLocation = 'us'
        self.campaignID = ''
        self.cfCookieFile = 'cf.txt'
        self.cfCookieFileOmniture = 'cf2.txt'
        self.dynamicVRFunnel = 'http://download.pirates.com/'
        self.hostDict = {
            0: 'Internal Disney PHP Collector Site',
            1: 'ehg-dig.hitbox.com/HG?',
            2: 'ehg-dig.hitbox.com/HG?',
            3: 'w88.go.com/b/ss/' }
        self.CurrentHost = ''
        self.URLtoSend = ''
        self.gameName = 'Pirates'
        self.browserName = 'Panda3D%20(' + self.gameName + ';%20' + sys.platform + ')'
        self.HTTPUserHeader = [
            ('User-agent', 'Panda3D')]
        self.osMajorver = ''
        self.osMinorver = ''
        self.osRevver = ''
        self.osBuild = ''
        self.osType = ''
        self.osComments = ''
        self.msWinTypeDict = {
            0: 'Win32s on Windows 3.1',
            1: 'Windows 95/98/ME',
            2: 'Windows NT/2000/XP',
            3: 'Windows CE' }
        self.milestoneDict = {
            0: 'New User',
            1: 'Create Account',
            2: 'View EULA',
            3: 'Accept EULA',
            4: 'Download Start',
            5: 'Download End',
            6: 'Installer Run',
            7: 'Launcher Start',
            8: 'Launcher Login',
            9: 'Client Opens',
            10: 'Create Pirate Loads',
            11: 'Create Pirate Exit',
            12: 'Cutscene One Start',
            13: 'Cutscene One Ends',
            14: 'Cutscene Two Start',
            15: 'Cutscene Thee Start',
            16: 'Cutscene Three Ends',
            17: 'Access Cannon',
            18: 'Cutscene Four Starts',
            19: 'Cutscene Four Ends',
            20: 'Dock - Start Game' }
        self.macTypeDict = {
            2: 'Jaguar',
            1: 'Puma',
            3: 'Panther',
            4: 'Tiger',
            5: 'Lepard' }
        self.milestone = ''
        self.pandaHTTPClientVarWSS = []
        self.pandaHTTPClientVarCTG = []
        self.pandaHTTPClientVarDM = []
        self.pandaHTTPClientVarSVI = []
        self.checkForCFfile()
        self.httpSession = HTTPClient()
        self.whatOSver()


    def checkForCFfile(self):
        if firstRun() == True:
            pass
        1
        if os.path.isfile(self.cfCookieFile) == False:
            firstRun('write', True)



    def whatOSver(self):
        if sys.platform == 'win32':
            self.osMajorver = str(sys.getwindowsversion()[0])
            self.osMinorver = str(sys.getwindowsversion()[1])
            self.osBuild = str(sys.getwindowsversion()[2])
            self.osType = str(sys.getwindowsversion()[3])
            self.osComments = str(sys.getwindowsversion()[4])
        elif sys.platform == 'darwin':
            self.osMajorver = '10'
            osxcmd = '/usr/sbin/system_profiler SPSoftwareDataType |/usr/bin/grep "System Version"'
            infopipe = os.popen(osxcmd, 'r')
            parseLine = infopipe.read()
            infopipe.close()
            del infopipe
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:101,代码来源:UserFunnel.py

示例11: __init__

 def __init__(self):
     self.http = HTTPClient()
     
     self.SendHeartbeat()
开发者ID:czorn,项目名称:Modifire,代码行数:4,代码来源:Heartbeat.py

示例12: FancyLoadingScreen


#.........这里部分代码省略.........

        self.hintLabel['text'] = self.hintText
        if self._FancyLoadingScreen__isVisible():
            self.hintLabel.show()



    def _FancyLoadingScreen__isVisible(self):
        return self.state


    def scheduleHide(self, function):
        base.cr.queueAllInterestsCompleteEvent()
        self.acceptOnce(function, self.interestComplete)


    def interestComplete(self):
        self.endStep('scheduleHide')
        self.hide()


    def _FancyLoadingScreen__setAdArt(self):
        return None
        imageFrame = self.model.find('**/frame')
        randomImageNumber = random.randint(0, len(screenShots) - 1)
        imageFileName = screenShots[randomImageNumber]
        self.adImage = loader.loadModel(imageFileName)
        self.adImage.reparentTo(imageFrame)
        self.adImage.setScale(2.1499999999999999 * 5, 1, 1.2 * 5)
        self.adImage.setPos(0, 0, 2.2999999999999998)
        self.adImage.setBin('fixed', 1)
        if randomImageNumber == 0:
            urlToGet = 'http://log.go.com/log?srvc=dis&guid=951C36F8-3ACD-4EB2-9F02-8E8A0A217AF5&drop=0&addata=3232:64675:408091:64675&a=0'
            self.httpSession = HTTPClient()
            self.nonBlockHTTP = self.httpSession.makeChannel(False)
            self.nonBlockHTTP.beginGetDocument(DocumentSpec(urlToGet))
            instanceMarker = 'FunnelLoggingRequest-%s' % str(random.randint(1, 1000))
            self.startCheckingAsyncRequest(instanceMarker)



    def startCheckingAsyncRequest(self, name):
        taskMgr.remove(name)
        taskMgr.doMethodLater(0.5, self.pollAdTask, name)


    def pollAdTask(self, task):
        result = self.nonBlockHTTP.run()
        if result == 0:
            self.stopCheckingAdTask(task)
        else:
            return Task.again


    def stopCheckingAdTask(self, name):
        taskMgr.remove(name)


    def cleanupLoadingScreen(self):
        if self.debugMode:
            self.loadingBarRoot.removeChildren()
            self.cleanupAnalysis()
            self.stepInfo = { }
            self.unmappedTicks = []

开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:65,代码来源:FancyLoadingScreen.py

示例13: patcherVer

        baseURL = patcherVer()[0].split('/lo')[0]
    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]
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:31,代码来源:UserFunnel.py


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