Hello,
I wanted to check to see whether I have proper access on the backend.
I have followed these documents and have tried the methods, as well as checked past forum posts.
https://twitterdev.github.io/search-tweets-python/
Each time, I see this output
`ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer’))`
ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
Even though the oauth seems correct.
Grabbing bearer token from OAUTH
Out[34]:
{'bearer_token': 'xxxx',
'endpoint': 'xxxx'}
I believe my yaml file is correct
search_tweets_api:
account_type: premium
endpoint: xxxx
consumer_key: xxxx
consumer_secret: xxxx
Is there any guidance you can provide? The code I have used is below.
Method 1
import pandas as pd, numpy as np; from searchtweets import ResultStream, gen_rule_payload, load_credentials, collect_results
premium_search_args = load_credentials("~/.twitter_keys.yaml",account_type="premium")
rule = gen_rule_payload("#Twitter", results_per_call=100)
tweets = collect_results(rule,
max_results=10,
result_stream_args=premium_search_args)
Method 2
rs = ResultStream(rule_payload=rule,
max_results=50,
max_pages=1,
**premium_search_args)
print(rs)
tweets = list(rs.stream())
Method 3
import json
from_date = "2016-06-01"
to_date = "2016-06-02"
rule = gen_rule_payload("#Twitter", results_per_call = 100, from_date = from_date, to_date = to_date)
rule = json.loads(rule)
print(rule)
tweets = collect_results(rule, max_results = 500, result_stream_args = premium_search_args)
[print(tweet.all_text) for tweet in tweets[0:10]]