Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Get pushes continuously #71

Closed
loristns opened this issue Feb 25, 2016 · 6 comments
Closed

Get pushes continuously #71

loristns opened this issue Feb 25, 2016 · 6 comments

Comments

@loristns
Copy link
Contributor

Hello,
I had a new problem using pushbullet.py : I want to get push continuously but i'm limited by query limits.
How can i get push everytime like in all pushbullet clients ?

Thanks

(sorry for bad english)

@kovacsbalu
Copy link
Collaborator

Hi,
try websocket. You can also check in my pushbullet-rpc
pushbulletrpc.py -> recv_and_process()

@loristns
Copy link
Contributor Author

Ok, I take a look at this.

But i've got an exception : InvalidKeyError when I start my programm but my key is valid...

@kovacsbalu
Copy link
Collaborator

Ohh, let's debug your key. :)

@loristns
Copy link
Contributor Author

Very strange, it work 10 seconds and after ... nothing.

@blubber85
Copy link

Hello,
i have really the same problem.
I guess the problem is the Ratelimiting:

Ratelimiting
When you do a request to the API you will receive headers like the following on the response:
X-Ratelimit-Limit: 32768
X-Ratelimit-Remaining: 32765
X-Ratelimit-Reset: 1432447070
These tell you what the ratelimit is, how much you have remaining and when it resets (integer seconds in Unix Time). The units are a sort of generic 'cost' number. A request costs 1 and a database operation costs 4. So reading 500 pushes costs about 500 database operations + 1 request = 500*4 + 1 = 2001. You can see how much a request cost by the change in X-Ratelimit-Remaining between two requests.

maybe it's possible that you can store this X-Ratelimit-Remaining and give it back over a function?

Thanks

@simonporter007
Copy link
Contributor

#40 seems related to this also?

It would seem fairly easy to implement the logic in _get_data() function to store the ratelimit information. Then a helper function added to pushbullet.py to return the remaining limit at any given time.

However, as @kovacsbalu said, the best way to continuously receive pushes is via websockets using the pushbullet real time event stream. I wouldn't mind having a go at implementing that but the websockets client library I'd use is for python 3.3+ only. I guess I could try websocket-client but it doesn't look as nice :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants