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


Python Channel类代码示例

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


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

示例1: test_pushMessage_to_all

def test_pushMessage_to_all(message):
    c = Channel(apiKey, secretKey)
    push_type = 3
    optional = dict()
    optional[Channel.MESSAGE_TYPE] = 1
    ret = c.pushMessage(push_type, message, message_key, optional)
    print ret
开发者ID:magiclake,项目名称:chaowei,代码行数:7,代码来源:sample.py

示例2: _manage_channels

 def _manage_channels(self):
     assert self.state_lock.locked()
     for cid, channel in self.active_channels.items():
         message = 'Location channel management removing %r from active.'
         if not channel.accepting_requests():
             self.debugout(message % channel, 1)
             self.active_channels.pop(cid)
             self.parallel_channels.decrement()
     maxchannels = self.MAXPARALLELCHANNELS
     numpending = len(self.pending_transactions)
     numchannels = self.parallel_channels.value
     if numchannels == 0:
         createchannel = True
     elif numchannels >= maxchannels:
         createchannel = False
     elif (numpending / numchannels) > self.IDEALBACKLOG:
         createchannel = True
     else:
         createchannel = False
     if createchannel:
         channel = Channel(self.monitor, self.debug)
         channel.setup_connection(self.host, self.port, self.protocol)
         self.free_channels.append(channel)
         self.parallel_channels.increment()
     return
开发者ID:mcruse,项目名称:monotone,代码行数:25,代码来源:asynchronous.py

示例3: test_pushMessage_to_tag

def test_pushMessage_to_tag():
    c = Channel(apiKey, secretKey)
    push_type = 2
    optional = dict()
    optional[Channel.TAG_NAME] = tagname
    optional[Channel.MESSAGE_TYPE] = 1
    # 	print 'hi:::::', push_type, message, message_key, optional
    ret = c.pushMessage(push_type, message, message_key, optional)
开发者ID:hejie,项目名称:tangmen,代码行数:8,代码来源:Final.py

示例4: test_pushMessage_to_tag

def test_pushMessage_to_tag():
    c = Channel(apiKey, secretKey)
    push_type = 2
    tag_name = 'push'
    optional = dict()
    optional[Channel.TAG_NAME] = tag_name
    ret = c.pushMessage(push_type, message, message_key, optional)
    print ret
开发者ID:alexhucy,项目名称:SmartData,代码行数:8,代码来源:sample.py

示例5: test_pushMessage_to_user

def test_pushMessage_to_user(user_id,channel_id,phone_system,secretKey,message):
	c = Channel(apiKey, secretKey)
	push_type = 1
	optional = dict()
	optional[Channel.USER_ID] = user_id
	optional[Channel.CHANNEL_ID] = channel_id
	optional[Channel.MESSAGE_TYPE] = 1
	ret = c.pushMessage(push_type, message, message_key, optional)
	print ret
开发者ID:magiclake,项目名称:chaowei,代码行数:9,代码来源:sample.py

示例6: test_queryBindList

def test_queryBindList():
	
	c = Channel(apiKey, secretKey)
	
	#optional = dict()
	
	#optional[Channel.CHANNEL_ID] =  channel_id
	
	c.queryBindList()	
开发者ID:buddyli,项目名称:python,代码行数:9,代码来源:push.py

示例7: test_pushMessage_to_user

def test_pushMessage_to_user():
    c = Channel(apiKey, secretKey)
    push_type = 1
    optional = dict()
    optional[Channel.USER_ID] = user_id
    optional[Channel.CHANNEL_ID] = channel_id
    # 推送通知类型
    optional[Channel.MESSAGE_TYPE] = 0
    ret = c.pushMessage(push_type, message, message_key, optional)
    print ret
开发者ID:seamancode,项目名称:pusher_python_sdk,代码行数:10,代码来源:sample.py

示例8: push_to_user

 def push_to_user(self, user, message):
     channel = Channel(self.__secret.apiKey, self.__secret.secretKey)
     push_type = 1
     optional = dict()
     optional[Channel.USER_ID] = user[0]
     optional[Channel.CHANNEL_ID] = user[1]
     optional[Channel.MESSAGE_TYPE] = 0
     alertMessage = "{'title':'%s', 'description':'%s', 'custom_content': { 'amber_alert_id':'%s', 'from_user_id':'%s' }}" % (message[0], message[1], message[2], message[3])
     #jsonMessage = json.dumps(updateMessage)
     ret = channel.pushMessage(push_type, alertMessage, message_key, optional)
     print (ret)
     return ret
开发者ID:fuzhouch,项目名称:amberalertcn,代码行数:12,代码来源:Pusher.py

示例9: test_pushMessage_to_user

def test_pushMessage_to_user():
    c = Channel(apiKey, secretKey)
    c.DEFAULT_HOST=dev_host
    push_type = 1
    optional = dict()
    optional[Channel.USER_ID] = 815730795201756090
    #optional[Channel.USER_ID] = 665778416804465913
    #optional[Channel.CHANNEL_ID] = 4617656892525519033
    optional[Channel.CHANNEL_ID] = 4320553738754859600
    #推送通知类型
    optional[Channel.DEVICE_TYPE] = 4
    optional[Channel.MESSAGE_TYPE] = 1
    optional['phone_type'] = 'io'
    ret = c.pushMessage(push_type, message, hashlib.md5(str(datetime.datetime.now())).hexdigest(), optional)
    print ret
开发者ID:alexhucy,项目名称:SmartData,代码行数:15,代码来源:sample.py

示例10: __init__

    def __init__(self, serverFacade, comodo):

        screen_width = 640
        screen_height = 480
        screen_flag = 0
        screen_depht = 32

        self.colors = {}
        self.sprites = {}
        self.channels = {}

        pygame.init()
        self.screen = pygame.display.set_mode((screen_width, screen_height), screen_flag, screen_depht)
        self.clock = pygame.time.Clock()

        self.serverFacade = serverFacade
        self.comodo = comodo

        self.__loadColors()
        self.__loadSprites()
        self.__loadChannels()
        
        self.channel = Channel()
        #self.channel = self.channels.get(str(self.comodo.getTv().getChannel()))
        #self.resolution = self.channel.get_size()
        print (320-320*.27, 180-180*.27)
开发者ID:felipemdrs,项目名称:Controle-Multimidia-Universal,代码行数:26,代码来源:ComodoUI.py

示例11: loadFromCachedMode

 def loadFromCachedMode(self):
     import Channel
     import Playlist
     
     
     if not self._cachedMode:
         raise ValueError('Cannot load from cached mode. Pages are not in cached mode')
     
     
     
     #sourcesToUpdate = []
     
     for page in self._pages:
         if page.items:
             raise ValueError('In cached mode, yet page has original videosource items')
         
         items = []
         for cachedItem in page.cacheableItems:
             if cachedItem[0] == SourceType.CHANNEL:
                 channelId = cachedItem[1] 
                 ytVideoSource, needsInfoUpdate = Channel.fromUserOrId(channelId=channelId)
                 
             else:
                 playlistId = cachedItem[1]
                 ytVideoSource, needsInfoUpdate = Playlist.fromPlaylistId(playlistId)
                 
             items.append(ytVideoSource)
             if needsInfoUpdate:     #ignored here
                 pass
             
                 
         page.items = items
         
     self._cachedMode = False
开发者ID:SportySpice,项目名称:Collections,代码行数:34,代码来源:Pages.py

示例12: test_pushMessage_to_user

def test_pushMessage_to_user():
    c = Channel(apiKey, secretKey)
    c.DEFAULT_HOST=dev_host
    push_type = 1
    optional = dict()
    #optional[Channel.USER_ID] = 900581881515728799
    optional[Channel.USER_ID] = 654406316281477917
    #optional[Channel.USER_ID] = 665778416804465913
    #optional[Channel.CHANNEL_ID] = 4617656892525519033
    optional[Channel.CHANNEL_ID] = 3800664848253686124
    #optional[Channel.CHANNEL_ID] = 3800664848253686124
    #推送通知类型
    optional[Channel.DEVICE_TYPE] = 4
    optional[Channel.MESSAGE_TYPE] = 1
    optional['phone_type'] = 'ios'
    ret = c.pushMessage(push_type, message, hashlib.md5(str(datetime.datetime.now())).hexdigest(), optional)
    print ret
开发者ID:bcc0421,项目名称:SmartData,代码行数:17,代码来源:sample.py

示例13: _responseProcess

 def _responseProcess(self, response):
     channels = []
             
     for item in response['items']:
         channel = Channel.fromChannelsRequest(item)
         channels.append(channel)            
         
         
     return channels
开发者ID:SportySpice,项目名称:Collections,代码行数:9,代码来源:Category.py

示例14: __init__

    def __init__(self):
        p = uuid.uuid4().int & 0xffffff
        av = uuid.uuid4().int & 0xffffff
        tak = uuid.uuid4().int & 0xffffff
        shm = uuid.uuid4().int & 0xffffff

        self.channel = chnl.getChannel(p,av,tak,shm)
        self.name = uuid.uuid1()
        return
开发者ID:JohnReeves,项目名称:python-csp,代码行数:9,代码来源:CChannel.py

示例15: _responseProcess

 def _responseProcess(response):  
     channels = []
     items = response['items']    
         
     for item in items:
         channel = Channel.fromSubscriptionsRequest(item)
         channels.append(channel)
         
     return channels
开发者ID:SportySpice,项目名称:Collections,代码行数:9,代码来源:Subscriptions.py


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