xdevplatform / Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
Apache License 2.0
2.66k stars 984 forks source link

Requests fails #68

Open gg4u opened 2 years ago

gg4u commented 2 years ago

Hi, there is an issue with requests I could not fix. Could you help? Using python 3 in Google Colab.

see: https://github.com/twitterdev/Twitter-API-v2-sample-code/blob/main/Recent-Search/recent_search.py

import os
import requests
import requests_oauthlib

[...]

connect_to_endpoint(search_url, query_params)

Screen Shot 2021-12-12 at 12 14 50 PM
kelvindoe22 commented 2 years ago

Python example fails all the time i do not know why. Exception: Request returned an error: 403 {"title":"Forbidden","detail":"Forbidden","type":"about:blank","status":403}

dandani-cs commented 2 years ago

Python example fails all the time i do not know why. Exception: Request returned an error: 403 {"title":"Forbidden","detail":"Forbidden","type":"about:blank","status":403}

For this specific request, can you check the search_url? You might be accessing a url that doesn't work, or that you're not logged in