Python API wrapper for the pushbullet API
Project description
Pyshbullet v1.1.50
Pyshbullet is a async-based API wrapper for the Pushbullet API service.
Example usage:
import pyshbullet
import asyncio
import os
client = pyshbullet.APIClient(TOKEN)
async def main():
userobj = await client.get_current_user()
print(userobj.created)
pushesobj = await client.get_push_history(limit=2)
print([message.sent.strftime('%m-%d-%Y') for message in pushesobj])
chats = await client.list_chats()
print([chat.created.strftime('%m-%d-%Y') for chat in chats])
print([chat.chatting_with.name for chat in chats if chat.chatting_with != None])
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
@client.event
async def on_message(message):
print(f"Message sent: {message.sent.strftime('%m-%d-%Y')}")
print(f'Message content: {message.content}')
print(f'Message type: {message.type}')
print(f'Message image url: {message.image_url}')
print(f'Message file url: {message.file_url}')
print(f'Message author: {message.author.name}')
print(f'Message author email: {message.author.email}')
@client.event
async def on_run():
print('Started running.')
client.run()
Replace TOKEN with your Pushbullet API token.
The code above gets the user associated with the API token, and will listen to the websocket. Once a new message is sent, it prints out the data of the message.
Documentation will be added in the future.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyshbullet-1.1.50.tar.gz
(28.0 kB
view hashes)
Built Distribution
Close
Hashes for pyshbullet-1.1.50-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c44c87d6385f09d591dfc852a64c2a7cfc2679cb09c09d34e0fe208453a084d |
|
MD5 | b161dd500eb85cfaa0c1f0cc4fbf013a |
|
BLAKE2b-256 | b5926127375b09a994127a46b8ab8bf36d4fb56fb689d5f7e86f78c794316626 |