Skip to content

Bot in Go that tweets random facts related to geography

Notifications You must be signed in to change notification settings

niteeshhegde/geografybot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Examples

Get the dependencies and examples

cd examples
go get .

User Auth (OAuth1)

A user access token (OAuth1) grants a consumer application access to a user's Twitter resources.

Setup an OAuth1 http.Client with the consumer key and secret and oauth token and secret.

export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx

To make requests as an application, on behalf of a user, create a twitter Client to get the home timeline, mention timeline, and more (example will not post Tweets).

go run user-auth.go

App Auth (OAuth2)

An application access token (OAuth2) allows an application to make Twitter API requests for public content, with rate limits counting against the app itself. App auth requests can be made to API endpoints which do not require a user context.

Setup an OAuth2 http.Client with the Twitter consumer key and secret.

export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx

To make requests as an application, create a twitter Client and get public Tweets or timelines or other public content.

go run app-auth.go

Streaming API

A user access token (OAuth1) is required for Streaming API requests. See above.

go run streaming.go

Hit CTRL-C to stop streaming. Uncomment different examples in code to try different streams.

About

Bot in Go that tweets random facts related to geography

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages