richard-better / pushbullet.py

A python client for http://pushbullet.com
MIT License
575 stars 110 forks source link

get_channel doesn't work #92

Closed Officedr0ne closed 5 years ago

Officedr0ne commented 8 years ago

my_channel = pb.channels[0] Or retrieve a channel by its channel_tag. Note that an InvalidKeyError is raised if the channel_tag does not exist my_channel = pb.get_channel('My Channel')

So pb.channels works fine, but pb.get_channel returns an error that pushbullet doesn't have that object. Any idea what might be wrong?

simonporter007 commented 7 years ago

It's only a one liner which tries to pull out the channel by tagname: req_channel = next((channel for channel in self.channels if channel.channel_tag == channel_tag), None)

So I can only presume that the channel_tag doesn't match any channel.channel_tag of your pb.channels, returning None instead. Can you reproduce this and give the specific channel names from the output of pb.channels and your call to get_channel()?

elanorigby commented 7 years ago

I'm having this same issue, but I'm certain the tag name is right.

print(pb.channels) -> [Channel(name: 'PEP_o_the_Morning' tag: 'pepo')]

print(pb.get_channel('pepo')) -> AttributeError: 'Pushbullet' object has no attribute 'get_channel'

simonporter007 commented 7 years ago

Ah. So I must have misread the original issue, apologies. It's clear with the last update. It looks like Pushbullet object doesn't have that method, which I can only presume is because the latest release hasn't included the more recent commit's. I added the get_channel method in #73

@elanorigby are you using a pusbullet.py version from git or from pip or something else?

elanorigby commented 7 years ago

I'm in the pip zone. Thanks for the quick response!

simonporter007 commented 7 years ago

@kovacsbalu @r-darwish Seems like a lot of code missing from the pip release. What's the plans for the next one?

kovacsbalu commented 7 years ago

@simonporter007 I don't know. Who manage pushbullet.py pip releases? Not me :)

simonporter007 commented 7 years ago

Ha ha! Well in that case no idea, I don't think randomchars is about these days. Might just have to recommend using git instead!

r-darwish commented 7 years ago

@simonporter007 I don't think I have permissions to upload a package to PyPi. In any case, I stopped using PushBullet a while ago so it's probably best if @randomchars will put someone else as a collaborator instead of me.

simonporter007 commented 7 years ago

@elanorigby Looks like they just created 0.11 tag which should get pushed to pypi. Should sort your issue if you upgrade it or if you've switched to install from git instead, then no worries.

elanorigby commented 7 years ago

Awesome, thanks.