Hello,
I have a problem with the searchtweets python implementation of the twitter API and I was wondering if anyone can help.
Here is my basic script:
import json
from searchtweets import ResultStream, load_credentials, gen_rule_payload
from searchtweets.api_utils import gen_request_parameters
from_date = "2020-03-31 00:00"
to_date = "2020-04-01 00:00"
login = load_credentials(filename="./src/search_tweets_creds_example.yaml",
yaml_key="search_tweets_ent_example",
env_overwrite=False)
rule = gen_rule_payload('#prayforboris -is:retweet',
results_per_call=100,
from_date=from_date,
to_date=to_date
)
rs = ResultStream(rule_payload=rule,
max_results=100,
**login)
results = list(rs.stream())
print(results)
with open('./data/first/tweets_{}_{}.json'.format(from_date, to_date), 'w') as fp:
json.dump(results, fp)
It works perfectly without the -is:retweet. is:retweet (i.e. without negation) doesn’t work either. I get a requests.exceptions.HTTPError, suggesting it doesn’t like the rule payload. I want to get tweets from that hashtag that aren’t retweets - can anyone help me work out why this won’t work?
Full disclosure - currently using the Sandbox for the Premium API. Is that the problem? The documentation suggests it should be accessible.
Similar problems here: Avoiding retweets ideas aside from -is:retweet and Issue with is:retweet and 422.
Yeah, confusingly, Sandbox Premium is different to Paid Premium - Operators by product | Docs | Twitter Developer Platform is:retweet is only enabled on a paid premium endpoint - so sandbox won’t work. I don’t know why they made is so sandbox is so different to the paid one - kinda defeats the purpose of a “sandbox” being a demo, should call it “Free” instead.
1 Like
@IgorBrigadir Thanks a lot for your reply. Agree with you - I will have to get a full premium account it seems!
system
Closed
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.