Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/randyzwitch/twitter.jl

Julia package to access Twitter API
https://github.com/randyzwitch/twitter.jl

julia twitter twitter-api twitter-client twitter-oauth

Last synced: 9 days ago
JSON representation

Julia package to access Twitter API

Awesome Lists containing this project

README

        

# Twitter.jl

A Julia package for interacting with the Twitter API.

Linux: [![Build Status](https://travis-ci.org/randyzwitch/Twitter.jl.png)](https://travis-ci.org/randyzwitch/Twitter.jl)

CodeCov: [![codecov](https://codecov.io/gh/randyzwitch/Twitter.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/randyzwitch/Twitter.jl)

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](https://developer.twitter.com/en/docs/twitter-api/v1). 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`.

## Authentication

Before one can make use of this package, you must create an application on the [Twitter's Developer Platform](https://dev.twitter.com).

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](https://stackoverflow.com/a/70958807/7619808).

## Installation

To install this package, enter `]` on the REPL to bring up Julia's package manager. Then add the package:

```julia
julia> ]
(v1.7) pkg> add Twitter
```
*Tip: Press `Ctrl+C` to return to the `julia>` prompt.*
## Usage

To run Twitter.jl, enter the following command in your Julia REPL

```julia
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.

```julia
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.*

## Code examples

See [runtests.jl](https://github.com/randyzwitch/Twitter.jl/blob/master/test/runtests.jl) for example function calls.

### Want to contribute?

Contributions are welcome! Kindly refer to the [contribution guidelines](CONTRIBUTING.md).