Skip to content
Twitter library for C++11.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
src/twitpp
.gitignore
.travis.yml
CMakeLists.txt
LICENSE
README.md

README.md

twitpp Build Status

A Twitter Library for C++11.

Requirement

  • GCC 4.8.0+, Clang 3.4+, Apple LLVM 6.0+
  • Boost C++ Libraries 1.55.0+
  • OpenSSL 1.0.1+
  • CMake 2.8.0+

Install

$ mkdir -p build && cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make
$ sudo make install

Usage

OAuth Authentication

twitpp::oauth::account account("CONSUMER", "CONSUMER_SECRET");

// get authorize_url
account.get_authorize_url();
std::cout << account.authorize_url() << std::endl;

// get oauth token
account.get_oauth_token("PIN")

std::cout << "consumer_key:    " << account.consumer_key()       << std::endl;
std::cout << "consumer_secret: " << account.consumer_secret()    << std::endl;
std::cout << "oauth_token:     " << account.oauth_token()        << std::endl;
std::cout << "oauth_secret:    " << account.oauth_token_secret() << std::endl;

Post Status

twitpp::oauth::client oauth(twitpp::oauth::account("CK", "CS", "AT", "AS"));

auto res = oauth.post("https://api.twitter.com/1.1/statuses/update.json",
                      {{"status", "Hello World!!"}});
std::cout << res.body << std::endl;

Streaming API

twitpp::oauth::client oauth(twitpp::oauth::account("CK", "CS", "AT", "AS"));

oauth.stream_get("https://userstream.twitter.com/1.1/user.json",
                 [](twitpp::net::response& response) {
  std::cout << response.body << std::endl;
});

also, see example.cc.

License

twitpp is licensed under the MIT license.

You can’t perform that action at this time.