Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Keeps crashing with 403 errors #43

Open
flipperbw opened this issue Nov 4, 2016 · 6 comments
Open

Keeps crashing with 403 errors #43

flipperbw opened this issue Nov 4, 2016 · 6 comments

Comments

@flipperbw
Copy link

flipperbw commented Nov 4, 2016

When I leave reddit_alert running, it keeps eventually crashing with this traceback:

Traceback (most recent call last):
File "/usr/local/bin/reddit_alert", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/prawtools/alert.py", line 77, in main
for comment in session.subreddit(subreddit).stream.comments():
File "/usr/local/lib/python2.7/site-packages/praw/models/util.py", line 40, in stream_generator
limit=limit, params={'before': before_fullname}))):
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 70, in next
return self.next()
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 43, in next
self._next_batch()
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 53, in _next_batch
self._listing = self._reddit.get(self.url, params=self.params)
File "/usr/local/lib/python2.7/site-packages/praw/reddit.py", line 207, in get
data = self.request('GET', path, params=params)
File "/usr/local/lib/python2.7/site-packages/praw/reddit.py", line 258, in request
return self._core.request(method, path, params=params, data=data)
File "/usr/local/lib/python2.7/site-packages/prawcore/sessions.py", line 119, in request
params)
File "/usr/local/lib/python2.7/site-packages/prawcore/sessions.py", line 73, in _request_with_retries
raise self.STATUS_EXCEPTIONSresponse.status_code
prawcore.exceptions.Forbidden: received 403 HTTP response

Any ideas?

@bboe
Copy link
Member

bboe commented Nov 4, 2016

What version of prawtools, praw, and prawcore are you running? Sounds like maybe the tokens aren't be updated properly.

@flipperbw
Copy link
Author

version praw-4.0.0b21-py2.py3-none-any.whl. It only happens after a while of running.

@bboe
Copy link
Member

bboe commented Nov 4, 2016

Would you say about after an hour of running?

@flipperbw
Copy link
Author

It's hard to tell, but yes probably. Usually I just check back in on the server and it's dead the next day, but it could well be an hour.

@flipperbw
Copy link
Author

flipperbw commented Nov 5, 2016

Just another update, last night produced this error:

Traceback (most recent call last):
File "/usr/local/bin/reddit_alert", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/prawtools/alert.py", line 77, in main
for comment in session.subreddit(subreddit).stream.comments():
File "/usr/local/lib/python2.7/site-packages/praw/models/util.py", line 40, in stream_generator
limit=limit, params={'before': before_fullname}))):
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 72, in next
return self.next()
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 45, in next
self._next_batch()
File "/usr/local/lib/python2.7/site-packages/praw/models/listing/generator.py", line 55, in _next_batch
self._listing = self._reddit.get(self.url, params=self.params)
File "/usr/local/lib/python2.7/site-packages/praw/reddit.py", line 210, in get
data = self.request('GET', path, params=params)
File "/usr/local/lib/python2.7/site-packages/praw/reddit.py", line 261, in request
return self._core.request(method, path, params=params, data=data)
File "/usr/local/lib/python2.7/site-packages/prawcore/sessions.py", line 119, in request
params)
File "/usr/local/lib/python2.7/site-packages/prawcore/sessions.py", line 62, in _request_with_retries
json=json, params=params)
File "/usr/local/lib/python2.7/site-packages/prawcore/rate_limit.py", line 28, in call
response = request_function(_args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/prawcore/requestor.py", line 48, in request
raise RequestException(exc, args, kwargs)
prawcore.exceptions.RequestException: error with request ('Connection aborted.', error("(104, 'ECONNRESET')",))

So I guess this one is different, but my rate limit is 180 seconds, which should be more than enough.

@bboe
Copy link
Member

bboe commented Nov 7, 2016

Looks like better exception handling is needed. Cannot do much about connection reset errors, other than log and retry. That should be a separate issue, however.

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

2 participants