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


Python PushBullet.get_channel方法代码示例

本文整理汇总了Python中pushbullet.PushBullet.get_channel方法的典型用法代码示例。如果您正苦于以下问题:Python PushBullet.get_channel方法的具体用法?Python PushBullet.get_channel怎么用?Python PushBullet.get_channel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pushbullet.PushBullet的用法示例。


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

示例1: PushBulletSender

# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import get_channel [as 别名]
class PushBulletSender(Sender):
    def __init__(self, setting):
        super(PushBulletSender, self).__init__(setting)

        self.pushbullet = PushBullet(self.config_api)
        if hasattr(self, 'config_channel'):
            self.pushbullet = self.pushbullet.get_channel(self.config_channel)

    def post(self, title, message, url):
        if url:
            message = '{}\n{}'.format(message, url)
        self.pushbullet.push_note(title, message)
开发者ID:d3m3vilurr,项目名称:ridinoti2pushbullet,代码行数:14,代码来源:pushbullet.py

示例2: PB_Alarm

# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import get_channel [as 别名]
class PB_Alarm(Alarm):
	
	def __init__(self, api_key):
		self.client = PushBullet(api_key) 
		log.info("PB_Alarm intialized.")
		push = self.client.push_note("PokeAlarm activated!", "We will alert you about pokemon.")
		
	def pokemon_alert(self, pokemon):
		#notification_text = "A wild " + pokemon['name'].title() + " has appeared!"
		# Or retrieve a channel by its channel_tag. Note that an InvalidKeyError is raised if the channel_tag does not exist
		#your pushbullet channelname
		my_channel = self.client.get_channel('YOURCHANNELNAME') 
		
		google_maps_link = gmaps_link(pokemon["lat"], pokemon["lng"])
		time_text =  pkmn_time_text(pokemon['disappear_time'])
		notification_text = "("+ pokemon['name'].title() + " found" +"! "+" "  + time_text + "."
		push = self.client.push_link(notification_text, google_maps_link, body=time_text)
		#send to channel
		push = self.client.push_link(notification_text, google_maps_link, body=time_text, channel=my_channel)
开发者ID:malosaa,项目名称:PokemonGo-Finder_,代码行数:21,代码来源:pb_alarm.py


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