This is my first time to deal with full archive sandbox and I had an error I hope someone help me.
I did same this code:
http://benalexkeen.com/interacting-with-the-twitter-api-using-python/

I defined my keys and create a dev environment
but on requests step I get an error

> auth_resp.status_code
 403
> auth_resp.json().keys()
 dict_keys(['errors'])
> access_token = auth_resp.json()[access_token]
NameError                                 Traceback (most recent call last)
<ipython-input-37-176830b5137e> in <module>
      1 # Keys in data response are token_type (bearer) and access_token (your access token)
----> 2 access_token = auth_resp.json()
[access_token]

NameError: name 'access_token' is not defined

I tried to write my access token but it gives me the same error


KeyError                                  Traceback (most recent call last)
<ipython-input-38-f2c1b01734fe> in <module>
      1 # Keys in data response are token_type (bearer) and access_token (your access token)
----> 2 access_token = auth_resp.json()[accessToken]

KeyError: 'my accessToken '

That tutorial is for the standard API it looks like, also, you can create your own keys in the developer app dashboard so you can skip that step to simplify things. I’d look at GitHub - twitterdev/search-tweets-python: Python client for the Twitter 'search Tweets' and 'count Tweets' endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints. for an example of how to use the premium API

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.