richard-better / pushbullet.py

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

push_file gives AttributeError #179

Open nonfatalexec opened 2 years ago

nonfatalexec commented 2 years ago

I'm getting an AttributeError for the attribute "device_iden" when I use push_file. There's no issues when I use push_note. See code and error output below.

pb = Pushbullet(apiKey)
with open("image_path.jpg", "rb") as img:
            file_data = pb.upload_file(img, "image.jpg")

for chat in pb.chats:
            if str(chat) == "Chat('My Name <myemail>)":
                push = chat.push_note("Title", "some text")
                push = chat.push_file(**file_data)
>>> push = chat.push_file(**file_data)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gerald/.local/lib/python3.10/site-packages/pushbullet/device.py", line 29, in push_file
    return self._account.push_file(file_name, file_url, file_type, body=body, title=title, device=self)
  File "/home/gerald/.local/lib/python3.10/site-packages/pushbullet/pushbullet.py", line 256, in push_file
    data.update(Pushbullet._recipient(device, chat, email, channel))
  File "/home/gerald/.local/lib/python3.10/site-packages/pushbullet/pushbullet.py", line 106, in _recipient
    data["device_iden"] = device.device_iden
AttributeError: 'Chat' object has no attribute 'device_iden'