find_token: Find a token from token cache that can perform an API call

Description Usage Arguments Value

View source: R/rate-limits.R

Description

Mostly meant for internal socialsampler use. Loads all tokens from the token database, or the token registered with rtweet if not tokens have been registered with socialsampler, creates the corresponding bearer tokens (see rtweet::bearer_token()), and returns the token that can serve meet the requests. If no tokens meet these requirements, waits until the minimum amount until the API rate limits reset for a token in the token database.

Usage

1
find_token(query, requests)

Arguments

query

The API endpoint you want to query. See https://developer.twitter.com/en/docs/basics/rate-limits.

requests

How many requests you need to make.

Value

A token that make the API request while respecting Twitter API rate limits.


alexpghayes/socialsampler documentation built on Jan. 3, 2022, 6:54 p.m.