Skip to main content

Twitter REST API v1.1 client for Python

Project description

[![PyPI version](https://badge.fury.io/py/twypy.svg)](http://badge.fury.io/py/twypy) [![Build Status](https://travis-ci.org/rfguri/twypy.svg?branch=master)](https://travis-ci.org/rogerfernandezg/twypy)

Twypy is a super lightweight Twitter REST API v1.1 client written in Python, based on [Birdy](https://github.com/inueni/birdy).

Minimizing lines of code it aims to be a simpler yet more intuitive aproach to avoid all the boilerplate that most of the clients has using a simplified call constructor.

The requests come with a built-in code syntax to easely map all API calls.

Advantages

  • Focused only on REST API

  • Better JSON object dispatcher

  • Optimized methods

Requirements

  • python >= 2.7

  • requests_oauthlib >= 0.3.2

Installation

You can install the package via easy_install or pip: `Bash easy_install twypy pip install twypy `

Usage

Import the module at the beginning of your file: `python from twypy.api import Api ` Init the client with your credentials: `python client = Api(client_key, client_secret, access_token, access_token_secret) ` Call [Twitter REST API](https://dev.twitter.com/docs/api/1.1) methods following this example pattern: ` <method> <first>/<second --> api.<first>.<second>.<method>.(<params>) ` #### GET So the following GET resource url: ` GET statuses/user_timeline | https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi ` with Twypy is handled with the following syntax: ` client.api.statuses.user_timeline.get(screen_name='twitterapi') ` A visual example of previous explanation with a response object goes like this:

`python response = client.api.statuses.user_timeline.get(screen_name='twitterapi') ` #### POST The same using a POST resource url: ` POST statuses/update | https://api.twitter.com/1.1/statuses/update.json?status='Maybe he'll finally find his keys. #peterfalk!' ` with Twypy is handled with the following syntax: ` client.api.statuses.update.post(status='Maybe he'll finally find his keys. #peterfalk!') ` A visual example of previous explanation with a response object goes like this:

`python response = client.api.statuses.update.post(status='Maybe he'll finally find his keys. #peterfalk!') `

#### RESPONSE To simply see the the JSON response just print the response object:

`python print response `

TODO

Licence

Twypy is Copyright © 2014 Roger Fernandez Guri. It is free software, and may be redistributed under the terms specified in the [LICENCE](https://github.com/rfguri/twypy/blob/master/LICENSE) file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twypy-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

twypy-1.0.0-py2.py3-none-any.whl (7.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file twypy-1.0.0.tar.gz.

File metadata

  • Download URL: twypy-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for twypy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5f8e450e72dece033eb0fa7d02cebc7bf1d6d9054f88c219855c6e449f3620d2
MD5 cbf8bdd8becc458a4646ff911771b648
BLAKE2b-256 9629cd086b354d76eed7378585c8482b40d2f337488dc032dfe60746999b9e91

See more details on using hashes here.

File details

Details for the file twypy-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for twypy-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4b8529b762926165c68356435b64c61b66f9a34e2c8eb41329704f1e31d55656
MD5 e425ce197df97fa47438dc28161290a9
BLAKE2b-256 efc66658456a062143b2c797af91194452b82d5ef93e87e368ac44fc888e8c7d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page