• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyndn.Data类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleDataInterests

    def handleDataInterests(self, prefix, interest, transport, prefixId):
        # TODO: verification
        
        # we match the components to the name, and any '_' components
        # are discarded. Then we run a MongoDB query and append the
        # object id to allow for excludes

        chosenSchema = (s for s in self.schemaList 
                if s.dbPrefix.match(prefix)).next()

        interestName = interest.getName()
        responseName = Name(interestName)
        nameFields = chosenSchema.matchNameToSchema(interestName)
        self.log.info("Data requested with params:\n\t{}".format(nameFields))
        allResults = []
        segment = 0
        try:
            segmentComponent = interest.getName()[-4]
            segment = segmentComponent.toSegment()
        except RuntimeError:
            pass
        
        (startPos, results) = self._segmentResponseData(nameFields, segment)
        for result in results:
            dataId = result[u'_id']
            self.log.debug("Found object {}".format(dataId))
            allResults.append(result)

        #responseName.append(str(dataId))
        totalCount = results.count(False)
        responseObject = {'count':totalCount, 'skip':startPos, 'results':allResults}
        responseData = Data(responseName)
        resultEncoded = BSON.encode(responseObject)
        responseData.setContent(resultEncoded)
        transport.send(responseData.wireEncode().buf())
开发者ID:thecodemaiden,项目名称:ndn-repo-3,代码行数:35,代码来源:repo.py


示例2: onInterest

    def onInterest(self, prefix, interest, transport, registeredPrefixId):
	print "received interest"
        initInterest = Name(interest.getName())
        print "interest name:",initInterest.toUri()
	d = Data(interest.getName().append(self.deviceComponent))
	try:
		print "start to set data's content"
                
		currentString = ','.join(currentList)
		d.setContent("songList of " +self.device+":"+currentString+ "\n")
		self.face.registerPrefix(self.changePrefix,self.onInterest,self.onRegisterFailed)	



	    

	except KeyboardInterrupt:
		print "key interrupt"
		sys.exit(1)
	except Exception as e:
		print e
		d.setContent("Bad command\n")
	finally:
		self.keychain.sign(d,self.certificateName)

	encodedData = d.wireEncode()
	transport.send(encodedData.toBuffer())
	print d.getName().toUri()
	print d.getContent()

	self.loop.close()
     
        self.face.shutdown()
        self.face = None
开发者ID:mengchenpei,项目名称:Mu-lighting,代码行数:34,代码来源:PC1.py


示例3: onDeviceListRequest

    def onDeviceListRequest(self, prefix, interest, transport, registeeredPrefix):
        interestName = interest.getName()
        username = interestName.get(4).getValue().toRawStr()
        #TODO guest check
        prefix = Name("/home/user/"+username)
        userHash = self._deviceUserAccessManager.getUserHash(prefix)
        userHMACKey = HMACKey(0,0,userHash,"userHMACKey")
        dump("device dict : ",self._deviceDict)       

        if ( self._accessControlManager.verifyInterestWithHMACKey(interest,userHMACKey) ):
            dump("Verified") 
            deviceProfileList = []
            for prefixStr in self._deviceDict.keys():
                tmp = self._deviceDict[prefixStr]['deviceProfile'].__dict__
                dump("tmp :",tmp)
                if (type(tmp["_prefix"]) != str):
                    tmp["_prefix"] = tmp["_prefix"].toUri()
                deviceProfileList.append(tmp)
           
            data = Data(interestName)
            data.setContent(json.dumps(deviceProfileList))
            self._accessControlManager.signDataWithHMACKey(data,userHMACKey)
            self.sendData(data,transport,sign=False)
        else:
            dump("Not verified")
开发者ID:philoL,项目名称:NDN-HOME,代码行数:25,代码来源:controller.py


示例4: benchmarkDecodeDataSeconds

def benchmarkDecodeDataSeconds(nIterations, useCrypto, encoding):
    """
    Loop to decode a data packet nIterations times.

    :param int nIterations: The number of iterations.
    :param bool useCrypto: If true, verify the signature.  If false, don't
      verify.
    :param Blob encoding: The wire encoding to decode.
    """
    # Initialize the private key storage in case useCrypto is true.
    identityStorage = MemoryIdentityStorage()
    privateKeyStorage = MemoryPrivateKeyStorage()
    keyChain = KeyChain(IdentityManager(identityStorage, privateKeyStorage),
                        SelfVerifyPolicyManager(identityStorage))
    keyName = Name("/testname/DSK-123")
    certificateName = keyName.getSubName(0, keyName.size() - 1).append(
      "KEY").append(keyName[-1]).append("ID-CERT").append("0")
    identityStorage.addKey(keyName, KeyType.RSA, Blob(DEFAULT_RSA_PUBLIC_KEY_DER))

    start = getNowSeconds()
    for i in range(nIterations):
        data = Data()
        data.wireDecode(encoding)

        if useCrypto:
            keyChain.verifyData(data, onVerified, onVerifyFailed)

    finish = getNowSeconds()

    return finish - start
开发者ID:WeiqiJust,项目名称:NDN-total,代码行数:30,代码来源:test_encode_decode_benchmark.py


示例5: generateData

    def generateData(self, baseName):
        '''
           This appends the segment number to the data name, since repo-ng tends to expect it
        '''
        # just make up some data and return it
        ts = (time.time())
        segmentId = 0 # compatible with repo-ng test: may change to test segmented data

        versionStr = baseName.get(-1).toEscapedString()
        dataName = Name(baseName)
        dataName.appendSegment(segmentId)

        d = Data(dataName)
        content = "(" + str(ts) +  ") Data named " + dataName.toUri()
        d.setContent(content)
        d.getMetaInfo().setFinalBlockID(segmentId)
        d.getMetaInfo().setFreshnessPeriod(-1)
        if shouldSign:
            self.keychain.sign(d, self.certificateName)
        else:
            d.setSignature(self.fakeSignature)

        stats.insertDataForVersion(versionStr, {'publish_time':time.time()})
        logger.debug('Publishing: '+d.getName().toUri())
        return d
开发者ID:thecodemaiden,项目名称:nfd-timing,代码行数:25,代码来源:mcc-event-publisher.py


示例6: onInterest

 def onInterest(prefix, interest, transport, prefixID):
     interestCallbackCount[0] += 1
     data = Data(interest.getName())
     data.setContent("SUCCESS")
     self.keyChain.sign(data, self.keyChain.getDefaultCertificateName())
     encodedData = data.wireEncode()
     transport.send(encodedData.toBuffer())
开发者ID:MAHIS,项目名称:PyNDN2,代码行数:7,代码来源:test_face_methods.py


示例7: test_copy_fields

 def test_copy_fields(self):
     data = Data(self.freshData.getName())
     data.setContent(self.freshData.getContent())
     data.setMetaInfo(self.freshData.getMetaInfo())
     self.credentials.signData(data)
     freshDump = dumpData(data)
     self.assertTrue(dataDumpsEqual(freshDump, initialDump), 'Freshly created data does not match original dump')
开发者ID:bboalimoe,项目名称:PyNDN2,代码行数:7,代码来源:test_data_methods.py


示例8: onPlayingCommand

    def onPlayingCommand(self, prefix, interest, transport, prefixId):
	print "receive interest"
        interestName = Name(interest.getName())
        commandComponent = interest.getName().get(self.prefix.size())
        if commandComponent == Name.Component("stop"):
            pass
        if commandComponent == Name.Component("play"):
            pass
        else:
            songName = commandComponent.toEscapedString()
	    print songName
	    songList = []
	    songList = songName.split('%2C')
	    print "songlist and its len",songList,len(songList)
	    for i in songList:
		self.song = i
            	fmusic = i+str("-music.mp3") 
		self.ftxt = i + str("-os.txt")
		self.ffreq = i + str("-freq.txt")
		print "FMUSIC:",fmusic 
		  
	    	self.thread = threading.Thread(target = self.mp.play_music, args = (fmusic,songList,self.q,))
	    	self.thread.daemon = True
            	g = GetFile(self._repoCommandPrefix, i, self._face, self.getOnset)
		#g = GetFile(self._repoCommandPrefix, ftxt, self._face, self.lightFunction)
            	g.oStream = open(fmusic,'wb')
            	g.start()
	   
		
	
	d = Data(interest.getName())
	d.setContent("start to play: " + songName + "\n")
	encodedData = d.wireEncode()
	transport.send(encodedData.toBuffer())	
开发者ID:mengchenpei,项目名称:Mu-lighting,代码行数:34,代码来源:p.py


示例9: onPlayingCommand

	def onPlayingCommand(self, prefix, interest, transport, prefixId):
		
		interestName = Name(interest.getName())
		commandComponent = interest.getName().get(self.prefix.size())
		if commandComponent == Name.Component("stop"):
			pass
		if commandComponent == Name.Component("play"):
			pass
		else:
			songName = commandComponent.toEscapedString()
	    
		songList = []
		songList = songName.split('%2C')
	    
		for i in songList:
			fmusic = i + str("-music.mp3") 
			print "started getting music file", i
			
			g = GetFile(self._repoCommandPrefix, i, self._face, self.getOnset, i)
			
			g.oStream = open(fmusic,'wb')
			g.start()
			
			#self._getFiles.append(g)
			
		d = Data(interest.getName())
		d.setContent("start to play: " + songName + "\n")
		encodedData = d.wireEncode()
		transport.send(encodedData.toBuffer())	
开发者ID:mengchenpei,项目名称:Mu-lighting,代码行数:29,代码来源:Music+player.py


示例10: benchmarkDecodeDataSeconds

def benchmarkDecodeDataSeconds(nIterations, useCrypto, keyType, encoding):
    """
    Loop to decode a data packet nIterations times.

    :param int nIterations: The number of iterations.
    :param bool useCrypto: If true, verify the signature.  If false, don't
      verify.
    :param KeyType keyType: KeyType.RSA or EC, used if useCrypto is True.
    :param Blob encoding: The wire encoding to decode.
    :return: The number of seconds for all iterations.
    :rtype: float
    """
    # Initialize the KeyChain in case useCrypto is true.
    keyChain = KeyChain("pib-memory:", "tpm-memory:")
    # This puts the public key in the pibImpl used by the SelfVerifyPolicyManager.
    keyChain.importSafeBag(SafeBag
      (Name("/testname/KEY/123"),
       Blob(DEFAULT_EC_PRIVATE_KEY_DER if keyType == KeyType.EC
            else DEFAULT_RSA_PRIVATE_KEY_DER, False),
       Blob(DEFAULT_EC_PUBLIC_KEY_DER if keyType == KeyType.EC
            else DEFAULT_RSA_PUBLIC_KEY_DER, False)))
    validator = Validator(ValidationPolicyFromPib(keyChain.getPib()))

    start = getNowSeconds()
    for i in range(nIterations):
        data = Data()
        data.wireDecode(encoding)

        if useCrypto:
            validator.validate(data,onVerifySuccess, onVerifyFailed)

    finish = getNowSeconds()

    return finish - start
开发者ID:named-data,项目名称:PyNDN2,代码行数:34,代码来源:test_encode_decode_benchmark.py


示例11: onInterest

    def onInterest(self, prefix, interest, face, interestFilterId, filter):
        """
        Append the next segment number to the prefix and send a new data packet.
        If the last packet is sent, then call self._onFinished().
        """
        maxSegment = 2
        if self._segment >= maxSegment:
            # We have already called self._onFinished().
            return

        dump("Got interest", interest.toUri())

        # Make and sign a Data packet for the segment.
        self._segment += 1
        data = Data(Name(prefix).appendSegment(self._segment))
        content = "Segment number " + repr(self._segment)
        data.content = content
        self._keyChain.sign(data, self._certificateName)

        face.putData(data)
        dump("Sent data packet", data.name.toUri())

        if self._segment >= maxSegment:
            # We sent the final data packet.
            self._onFinished()
开发者ID:named-data,项目名称:PyNDN2,代码行数:25,代码来源:watched_insertion.py


示例12: test_malformed_certificate

    def test_malformed_certificate(self):
        # Copy the default certificate.
        malformedCertificate = Data(
          self._fixture._subIdentity.getDefaultKey().getDefaultCertificate())
        malformedCertificate.getMetaInfo().setType(ContentType.BLOB)
        self._fixture._keyChain.sign(
          malformedCertificate, SigningInfo(self._fixture._identity))
        # It has the wrong content type and a missing ValidityPeriod.
        try:
            CertificateV2(malformedCertificate).wireEncode()
            self.fail("Did not throw the expected exception")
        except CertificateV2.Error:
            pass
        else:
            self.fail("Did not throw the expected exception")

        originalProcessInterest = self._fixture._face._processInterest
        def processInterest(interest, onData, onTimeout, onNetworkNack):
            if interest.getName().isPrefixOf(malformedCertificate.getName()):
                onData(interest, malformedCertificate)
            else:
                originalProcessInterest.processInterest(
                  interest, onData, onTimeout, onNetworkNack)
        self._fixture._face._processInterest = processInterest

        data = Data(Name("/Security/V2/ValidatorFixture/Sub1/Sub2/Data"))
        self._fixture._keyChain.sign(data, SigningInfo(self._fixture._subIdentity))

        self.validateExpectFailure(data, "Signed by a malformed certificate")
        self.assertEqual(1, len(self._fixture._face._sentInterests))
开发者ID:named-data,项目名称:PyNDN2,代码行数:30,代码来源:test_validator.py


示例13: test_hyper_relation

    def test_hyper_relation(self):
        # Set up the validator.
        fetcher = CertificateFetcherOffline()
        validator = ValidatorConfig(fetcher)
        validator.load(
          os.path.join(self._policyConfigDirectory, "hyperrelation_ruleset.conf"))

        # Set up a Data packet and result object.
        data = Data()
        KeyLocator.getFromSignature(data.getSignature()).setType(KeyLocatorType.KEYNAME)
        result = TestValidationResult(data)

        data.setName(Name("/SecurityTestSecRule/Basic/Longer/Data2"))

        KeyLocator.getFromSignature(data.getSignature()).setKeyName(
          Name("/SecurityTestSecRule/Basic/Longer/KEY/123"))
        result.checkPolicy(validator)
        self.assertTrue(result._calledFailure and not result.calledContinue_)
        KeyLocator.getFromSignature(data.getSignature()).setKeyName(
          Name("/SecurityTestSecRule/Basic/KEY/123"))
        result.checkPolicy(validator)
        self.assertTrue(result._calledFailure and not result.calledContinue_)

        data.setName(Name("/SecurityTestSecRule/Basic/Other/Data1"))

        KeyLocator.getFromSignature(data.getSignature()).setKeyName(
          Name("/SecurityTestSecRule/Basic/Longer/KEY/123"))
        result.checkPolicy(validator)
        self.assertTrue(result._calledFailure and not result.calledContinue_)
        KeyLocator.getFromSignature(data.getSignature()).setKeyName(
          Name("/SecurityTestSecRule/Basic/KEY/123"))
        result.checkPolicy(validator)
        self.assertTrue(result._calledFailure and not result.calledContinue_)
开发者ID:named-data,项目名称:PyNDN2,代码行数:33,代码来源:test_validation_policy_config.py


示例14: loadApplications

    def loadApplications(self, directory = None, override = False):
        if not directory:
            directory = self._applicationDirectory
        if override:
            self._applications.clear()
        if os.path.exists(directory):
            for f in os.listdir(directory):
                fullFileName = os.path.join(directory, f)
                if os.path.isfile(fullFileName) and f.endswith('.conf'):
                    appName = f.rstrip('.conf')
                    if appName in self._applications and not override:
                        print("loadApplications: " + appName + " already exists, do nothing for configuration file: " + fullFileName)
                    else:
                        self._applications[appName] = {"tree": BoostInfoParser(), "dataPrefix": [], "version": int(time.time())}
                        self._applications[appName]["tree"].read(fullFileName)
                        data = Data(Name(self.prefix).append(appName).append("_schema").appendVersion(self._applications[appName]["version"]))
                        data.setContent(str(self._applications[appName]["tree"].getRoot()))
                        self.signData(data)
                        self._memoryContentCache.add(data)
                        try:
                            validatorTree = self._applications[appName]["tree"]["validator"][0]
                            for rule in validatorTree["rule"]:
                                self._applications[appName]["dataPrefix"].append(rule["id"][0].value)
                        # TODO: don't swallow any general exceptions, we want to catch only KeyError (make sure) here
                        except Exception as e:
                            print("loadApplications parse configuration file " + fullFileName + " : " + str(e))

        return
开发者ID:remap,项目名称:ndn-flow,代码行数:28,代码来源:iot_controller.py


示例15: _onConfigurationReceived

    def _onConfigurationReceived(self, prefix, interest, transport, prefixId):
        # the interest we get here is signed by HMAC, let's verify it
        self.tempPrefixId = prefixId # didn't get it from register because of the event loop
        dataName = Name(interest.getName())
        replyData = Data(dataName)
        if (self._hmacHandler.verifyInterest(interest)):
            # we have a match! decode the controller's name
            configComponent = interest.getName().get(prefix.size())
            replyData.setContent('200')
            self._hmacHandler.signData(replyData, keyName=self.prefix)
            transport.send(replyData.wireEncode().buf())

            environmentConfig = DeviceConfigurationMessage()
            ProtobufTlv.decode(environmentConfig, configComponent.getValue()) 
            networkPrefix = self._extractNameFromField(environmentConfig.configuration.networkPrefix)
            controllerName = self._extractNameFromField(environmentConfig.configuration.controllerName)
            controllerName = Name(networkPrefix).append(controllerName)

            self._policyManager.setEnvironmentPrefix(networkPrefix)
            self._policyManager.setTrustRootIdentity(controllerName)

            self.deviceSuffix = self._extractNameFromField(environmentConfig.configuration.deviceSuffix)

            self._configureIdentity = Name(networkPrefix).append(self.deviceSuffix) 
            self._sendCertificateRequest(self._configureIdentity)
开发者ID:zhehaowang,项目名称:ndn-pi,代码行数:25,代码来源:iot_node.py


示例16: publishData

 def publishData(self, key, key_ts, payload, timestamp):
     data = Data(Name(self.prefix).append(bytearray(timestamp)))
     iv = Random.new().read(AES.block_size)
     encryptor = AES.new(key, AES.MODE_CBC, iv)
     data.setContent(bytearray(key_ts + iv + encryptor.encrypt(pad(json.dumps(payload)))))
     data.getMetaInfo().setFreshnessPeriod(5000)
     self.keychain.sign(data, self.cert_name)
     self.publisher.put(data)
开发者ID:wentaoshang,项目名称:ndn-sensor,代码行数:8,代码来源:publish_modbus.py


示例17: test_refresh_10s

    def test_refresh_10s(self):
        with open('policy_config/testData', 'r') as dataFile:
            encodedData = dataFile.read()
            data = Data()
            dataBlob = Blob(b64decode(encodedData))
            data.wireDecode(dataBlob)

        # This test is needed, since the KeyChain will express interests in
        # unknown certificates.
        vr = doVerify(self.policyManager, data)

        self.assertTrue(vr.hasFurtherSteps,
          "ConfigPolicyManager did not create ValidationRequest for unknown certificate")
        self.assertEqual(vr.successCount, 0,
          "ConfigPolicyManager called success callback with pending ValidationRequest")
        self.assertEqual(vr.failureCount, 0,
          "ConfigPolicyManager called failure callback with pending ValidationRequest")

        # Now save the cert data to our anchor directory, and wait.
        # We have to sign it with the current identity or the policy manager
        # will create an interest for the signing certificate.

        cert = CertificateV2()
        certData = b64decode(CERT_DUMP)
        cert.wireDecode(Blob(certData, False))
        signingInfo = SigningInfo()
        signingInfo.setSigningIdentity(self.identityName)
        # Make sure the validity period is current for two years.
        now = Common.getNowMilliseconds()
        signingInfo.setValidityPeriod(ValidityPeriod
          (now, now + 2 * 365 * 24 * 3600 * 1000.0))

        self.keyChain.sign(cert, signingInfo)
        encodedCert = b64encode(cert.wireEncode().toBytes())
        with open(self.testCertFile, 'w') as certFile:
            certFile.write(Blob(encodedCert, False).toRawStr())

        # Still too early for refresh to pick it up.
        vr = doVerify(self.policyManager, data)

        self.assertTrue(vr.hasFurtherSteps,
          "ConfigPolicyManager refresh occured sooner than specified")
        self.assertEqual(vr.successCount, 0,
          "ConfigPolicyManager called success callback with pending ValidationRequest")
        self.assertEqual(vr.failureCount, 0,
          "ConfigPolicyManager called failure callback with pending ValidationRequest")
        time.sleep(6)

        # Now we should find it.
        vr  = doVerify(self.policyManager, data)

        self.assertFalse(vr.hasFurtherSteps,
          "ConfigPolicyManager did not refresh certificate store")
        self.assertEqual(vr.successCount, 1,
          "Verification success called {} times instead of 1".format(
            vr.successCount))
        self.assertEqual(vr.failureCount, 0,
          "ConfigPolicyManager did not verify valid signed data")
开发者ID:named-data,项目名称:PyNDN2,代码行数:58,代码来源:test_policy_manager_v2.py


示例18: testEmptyContent

    def testEmptyContent(self):
        state = PSyncState()

        # Simulate getting a buffer of content from a segment fetcher.
        data = Data()
        data.setContent(state.wireEncode())

        state2 = PSyncState(data.getContent())
        self.assertEqual(0, len(state2.getContent()))
开发者ID:named-data,项目名称:PyNDN2,代码行数:9,代码来源:test_psync_state.py


示例19: test_encode_decode

    def test_encode_decode(self):
        data = Data()
        data.wireDecode(codedData)
        data.setContent(data.getContent())
        encoding = data.wireEncode()

        reDecodedData = Data()
        reDecodedData.wireDecode(encoding)
        self.assertEqual(dumpData(reDecodedData), initialDump, 'Re-decoded data does not match original dump')
开发者ID:bboalimoe,项目名称:PyNDN2,代码行数:9,代码来源:test_data_methods.py


示例20: onAccessTokenListRequest

    def onAccessTokenListRequest(self, prefix, interest, transport, registeredPrefixId):
        interestName = interest.getName()
  
        devicePrefixStr = "/home"+interestName.getSubName(2,3).toUri()
        dump("device prefix: ",devicePrefixStr)       
 
        username = interestName.get(6).getValue().toRawStr()
        userPrefix = Name("/home/user/"+username)
        userHash = self._deviceUserAccessManager.getUserHash(userPrefix)
        userHMACKey = HMACKey(0,0,userHash,"userHMACKey")
        
        if ( self._accessControlManager.verifyInterestWithHMACKey(interest,userHMACKey) ):
            dump("Verified")
           
            accessTokenInfoList = []
 
            seed = self._deviceUserAccessManager.getSeed(Name(devicePrefixStr))           
            dump("seed",seed)
            dump("device dict", self._deviceDict)
            dump("devicePrefixStr",devicePrefixStr)
            commandList = []
            try :
                commandList = self._deviceDict[devicePrefixStr]['commandList']
            except Exception:
                dump("No such device")
            dump("Command List: ",commandList)

            for eachCommand in commandList:
                commandTokenNameStr = devicePrefixStr+'/'+eachCommand+'/token/0'
                commandTokenSequence = 0
                seedSequence = 0
                commandToken = hmac.new(seed.getKey(), commandTokenNameStr, sha256).digest()
                accessTokenNameStr = commandTokenNameStr+'/user/'+username+'/token/0'
                accessToken = hmac.new(commandToken, accessTokenNameStr, sha256).digest()        
                                
                
                dump("commandTkenName ------------- : ",commandTokenNameStr)
                dump("commandTken     ------------- : ",base64.b64encode(commandToken))
                dump("accessTokenName ------------- : ",accessTokenNameStr)
                dump("accessToken ----------------- : ",base64.b64encode(accessToken))
                dump("accessToken hex-------------- : ",hmac.new(commandToken, accessTokenNameStr, sha256).hexdigest())
                accessTokenInfo = {}
                accessTokenInfo['command'] = eachCommand
                accessTokenInfo['commandTokenSequence'] = commandTokenSequence
                accessTokenInfo['seedSequence'] = seedSequence
                accessTokenInfo['accessToken'] = base64.b64encode( accessToken)
                accessTokenInfo['accessTokenName'] = accessTokenNameStr

                accessTokenInfoList.append(accessTokenInfo)
            data = Data(interestName)
         
            data.setContent(json.dumps(accessTokenInfoList))
            self._accessControlManager.signDataWithHMACKey(data,userHMACKey)
            self.sendData(data,transport,sign=False)
        else:
            dump("Not verified")
开发者ID:philoL,项目名称:NDN-HOME,代码行数:56,代码来源:controller.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyndn.Face类代码示例发布时间:2022-05-27
下一篇:
Python pync.Notifier类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap