kiaheng
kiaheng

Reputation: 13

Problem getting sampled stream from twitter(python)

I am trying to get the sampled stream using the following code:

         url = "https://api.twitter.com/labs/1/tweets/stream/sample"
         bearer_token = get_bearer_token(##########, #########)
         bearer = "Bearer " + bearer_token
         headers = {"Authorization": bearer}
         print(requests.post(url, headers=headers))

I am using the oauth here.

Unfortunately it is giving me a 405 response. Help would be greatly appreciated.

Upvotes: 1

Views: 40

Answers (1)

sparack
sparack

Reputation: 26

Looks like you are using POST vs GET.

Check out the API reference here: https://developer.twitter.com/en/docs/labs/sampled-stream/api-reference/get-tweets-stream-sample

Upvotes: 1

Related Questions