tommeagher / heroku_ebooks

An archive of a script to generate Markov chains and to post to an _ebooks account on Twitter using Heroku. No longer actively supported.
264 stars 163 forks source link

Twitter API v2 endpoints? #72

Closed duck-cpu closed 1 year ago

duck-cpu commented 2 years ago

Any chance this can be updated to work with v2 endpoints? As of right now, the endpoints in this code don't work unless the user's app is approved for "Elevated" developer access.

Traceback (most recent call last):
  File "/app/ebooks.py", line 161, in <module>
    handle_stats = api.GetUser(screen_name=user)
  File "/app/.heroku/python/lib/python3.9/site-packages/twitter/api.py", line 2869, in GetUser
    data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
  File "/app/.heroku/python/lib/python3.9/site-packages/twitter/api.py", line 4908, in _ParseAndCheckTwitter
    self._CheckForTwitterError(data)
  File "/app/.heroku/python/lib/python3.9/site-packages/twitter/api.py", line 4928, in _CheckForTwitterError
    raise TwitterError(data['errors'])
twitter.error.TwitterError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}] 
duck-cpu commented 2 years ago

Actually, if you don't mind. I believe I almost have this working. I'd like to be assigned this if you think it's something worth adding.

tommeagher commented 2 years ago

Hi @shinylotad, this isn't an error I've seen, but i also honestly haven't looked at this code in quite a long time. If you want to take a crack at pull request dealing with this issue, I'd be happy to take a look at it.

tommeagher commented 1 year ago

I believe this addressed by @supermodelscientist in #74