Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Premium search APIs #505

Open
D4thor opened this issue Feb 5, 2019 · 2 comments
Open

Premium search APIs #505

D4thor opened this issue Feb 5, 2019 · 2 comments

Comments

@D4thor
Copy link

D4thor commented Feb 5, 2019

Hey,
how do I setup twython with the full-archive endpoint for which premium API access?
https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search
In the endpoints.py I found no hint where to define the search URL described in the link above.

The background of my research project is as follows:
For a sentiment analysis, I need to crawl Tweets related to a specific topic / hashtags "from date" "to date" in 2016.
Btw, please let me if you have any tips how I can perform my search request with twython. So far my skills are quite limited.

Thanks and all the best,
David

@michaelhelmick
Copy link
Collaborator

Hi,

You should be able to just authenticate with OAuth 1 or 2 and then call get:

t = Twython(...)
t.get('search/<product>/<label>')

Hope this helps!

@D4thor
Copy link
Author

D4thor commented Feb 6, 2019

Thanks for the fast reply!

Unfortunately I don't understand exactly what you mean, respectively where do I have to change my credentials. That is, in the official Twitter Dev Api ( https://github.com/twitterdev/search-tweets-python )
they write about an authentification like this:

YAML method
For premium customers, the simplest credential file should look like this:

search_tweets_api:
  account_type: premium
  endpoint: <FULL_URL_OF_ENDPOINT>
  consumer_key: <CONSUMER_KEY>
  consumer_secret: <CONSUMER_SECRET>

For developers who have multiple endpoints and/or search products, you can keep all credentials in the same file and specify specific keys to use. --credential-file-key specifies this behavior in the command line app. An example:

search_tweets_30_day_dev:
  account_type: premium
  endpoint: <FULL_URL_OF_ENDPOINT>
  consumer_key: <KEY>
  consumer_secret: <SECRET>
  (optional) bearer_token: <TOKEN>


search_tweets_30_day_prod:
  account_type: premium
  endpoint: <FULL_URL_OF_ENDPOINT>
  bearer_token: <TOKEN>

search_tweets_fullarchive_dev:
  account_type: premium
  endpoint: <FULL_URL_OF_ENDPOINT>
  bearer_token: <TOKEN>

search_tweets_fullarchive_prod:
  account_type: premium
  endpoint: <FULL_URL_OF_ENDPOINT>
  bearer_token: <TOKEN>

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants