A Julia package for interacting with the Twitter API.
Twitter.jl is a Julia package to work with the Twitter API v1.1. Currently, only the REST API methods are supported; streaming API endpoints aren't implemented at this time.
All functions have required arguments for those parameters required by Twitter and an options
keyword argument to provide a Dict{String, String}
of optional parameters Twitter API documentation. Most function calls will return either a Dict
or an Array <: TwitterType
. Bad requests will return the response code from the API (403
, 404
, etc).
DataFrame methods are defined for functions returning composite types: Tweets
, Places
, Lists
, and Users
.
Before one can make use of this package, you must create an application on the Twitter's Developer Platform.
Once your application is approved, you can access your dashboard/portal to grab your authentication credentials from the "Details" tab of the application.
Note that you will also want to ensure that your App has Read / Write OAuth access in order to post tweets. You can find out more about this on Stack Overflow.
To install this package, enter ]
on the REPL to bring up Julia's package manager. Then add the package:
julia> ]
(v1.7) pkg> add Twitter
Tip: Press Ctrl+C
to return to the julia>
prompt.
To run Twitter.jl, enter the following command in your Julia REPL
julia> using Twitter
Then the a global variable has to be declared with the twitterauth
function. This function holds the consumer_key
(API Key), consumer_secret
(API Key Secret), oauth_token
(Access Token), and oauth_secret
(Access Token Secret) respectively.
twitterauth("6nOtpXmf...", # API Key
"sES5Zlj096S...", # API Key Secret
"98689850-Hj...", # Access Token
"UroqCVpWKIt...") # Access Token Secret
- Ensure you put your credentials in an env file to avoid pushing your secrets to the public 🙀.
Note: This package does not currently support OAuth authentication.
See runtests.jl for example function calls.
Contributions are welcome! Kindly refer to the contribution guidelines.