Skip to content

Commit 57f1a3c

Browse files
committed
merge master
2 parents 91d425d + b49b103 commit 57f1a3c

117 files changed

Lines changed: 4118 additions & 1134 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ htmlcov
4242
env
4343

4444
violations.flake8.txt
45+
46+
# Built docs
47+
doc/_build/**

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ before_install:
99

1010
install:
1111
- travis_retry pip install .
12-
- pip install -r requirements.txt
12+
- pip install -r requirements.testing.txt
1313

1414
script:
1515
- make test

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A Python wrapper around the Twitter API.
55
By the `Python-Twitter Developers <python-twitter@googlegroups.com>`_
66

77
.. image:: https://img.shields.io/pypi/v/python-twitter.svg
8-
:target: https://pypi.python.org/pypi/parsedatetime/
8+
:target: https://pypi.python.org/pypi/python-twitter/
99
:alt: Downloads
1010

1111
.. image:: https://travis-ci.org/bear/python-twitter.svg?branch=master
@@ -84,7 +84,7 @@ The library provides a Python wrapper around the Twitter API and the Twitter dat
8484
Using with Django
8585
----
8686

87-
Additional template tags that expand tweet urls and urlize tweet text. See the django template tags available for use with python-twitter: https://github.com/radlws/python-twitter-django-tags
87+
Additional template tags that expand tweet urls and urlize tweet text. See the django template tags available for use with python-twitter: https://github.com/radzhome/python-twitter-django-tags
8888

8989
-----
9090
Model
@@ -124,25 +124,25 @@ To create an instance of the ``twitter.Api`` with login credentials (Twitter now
124124

125125
To see if your credentials are successful::
126126

127-
>>> print api.VerifyCredentials()
127+
>>> print(api.VerifyCredentials())
128128
{"id": 16133, "location": "Philadelphia", "name": "bear"}
129129

130130
**NOTE**: much more than the small sample given here will print
131131

132132
To fetch a single user's public status messages, where ``user`` is a Twitter *short name*::
133133

134134
>>> statuses = api.GetUserTimeline(screen_name=user)
135-
>>> print [s.text for s in statuses]
135+
>>> print([s.text for s in statuses])
136136

137137
To fetch a list a user's friends (requires authentication)::
138138

139139
>>> users = api.GetFriends()
140-
>>> print [u.name for u in users]
140+
>>> print([u.name for u in users])
141141

142142
To post a Twitter status message (requires authentication)::
143143

144144
>>> status = api.PostUpdate('I love python-twitter!')
145-
>>> print status.text
145+
>>> print(status.text)
146146
I love python-twitter!
147147

148148
There are many more API methods, to read the full API documentation::

doc/conf.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import sys
15+
import os
16+
import shlex
17+
18+
sys.path.append(os.path.abspath('../'))
1519

1620
# If extensions (or modules to document with autodoc) are in another directory,
1721
# add these directories to sys.path here. If the directory is relative to the
@@ -25,7 +29,12 @@
2529

2630
# Add any Sphinx extension module names here, as strings. They can be extensions
2731
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = []
32+
extensions = [
33+
'sphinx.ext.autodoc',
34+
'sphinx.ext.coverage',
35+
'sphinx.ext.viewcode',
36+
'sphinx.ext.napoleon'
37+
]
2938

3039
# Add any paths that contain templates here, relative to this directory.
3140
templates_path = ['_templates']
@@ -41,16 +50,16 @@
4150

4251
# General information about the project.
4352
project = u'python-twitter'
44-
copyright = u'2013, python-twitter@googlegroups.com'
53+
copyright = u'2016, python-twitter@googlegroups.com'
4554

4655
# The version info for the project you're documenting, acts as replacement for
4756
# |version| and |release|, also used in various other places throughout the
4857
# built documents.
4958
#
5059
# The short X.Y version.
51-
version = '1.0'
60+
version = '3.0rc1'
5261
# The full version, including alpha/beta/rc tags.
53-
release = '1.0'
62+
release = '3.0rc1'
5463

5564
# The language for content autogenerated by Sphinx. Refer to documentation
5665
# for a list of supported languages.
@@ -94,7 +103,7 @@
94103

95104
# The theme to use for HTML and HTML Help pages. See the documentation for
96105
# a list of builtin themes.
97-
html_theme = 'default'
106+
html_theme = 'sphinx_rtd_theme'
98107

99108
# Theme options are theme-specific and customize the look and feel of a theme
100109
# further. For a list of options available for each theme, see the

doc/getting_started.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Getting Started
2+
===============
3+
4+
Getting your application tokens
5+
+++++++++++++++++++++++++++++++
6+
7+
.. danger::
8+
9+
This section is subject to changes made by Twitter and may not always be completely up-to-date. If you see something change on their end, please create a `new issue on Github <https://github.com/bear/python-twitter/issues/new>`_ or submit a pull request to update it.
10+
11+
12+
In order to use the python-twitter API client, you first need to acquire a set of application tokens. These will be your ``consumer_key`` and ``consumer_secret``, which get passed to ``twitter.Api()`` when starting your application.
13+
14+
Create your app
15+
________________
16+
17+
The first step in doing so is to create a `Twitter App <https://apps.twitter.com/>`_. Click the "Create New App" button and fill out the fields on the next page.
18+
19+
20+
.. image:: python-twitter-app-creation-part1.png
21+
22+
If there are any problems with the information on that page, Twitter will complain and you can fix it. (Make sure to get the name correct - it is unclear if you can change this later.) On the next screen, you'll see the application that you created and some information about it:
23+
24+
Your app
25+
_________
26+
27+
Once your app is created, you'll be directed to a new page showing you some information about it.
28+
29+
.. image:: python-twitter-app-creation-part2.png
30+
31+
Your Keys
32+
_________
33+
34+
Click on the "Keys and Access Tokens" tab on the top there, just under the green notification in the image above.
35+
36+
37+
.. image:: python-twitter-app-creation-part3.png
38+
39+
At this point, you can test out your application using the keys under "Your Application Tokens". The ``twitter.Api()`` object can be created as follows::
40+
41+
import twitter
42+
api = twitter.Api(consumer_key=[consumer key],
43+
consumer_secret=[consumer secret],
44+
access_token_key=[access token]
45+
access_token_secret=[access token secret])
46+
47+
If you are creating an application for end users/consumers, then you will want them to authorize you application, but that is outside the scope of this document.
48+
49+
And that should be it! If you need a little more help, check out the `examples on Github <https://github.com/bear/python-twitter/tree/master/examples>`_. If you have an open source application using python-twitter, send us a link and we'll add a link to it here.

doc/index.rst

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,31 @@
11
.. python-twitter documentation master file, created by
2-
sphinx-quickstart on Fri Aug 30 14:37:05 2013.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
52
63
Welcome to python-twitter's documentation!
74
==========================================
85
**A Python wrapper around the Twitter API.**
96

107
Author: The Python-Twitter Developers <python-twitter@googlegroups.com>
118

12-
Introduction
13-
------------
14-
This library provides a pure Python interface for the `Twitter API <https://dev.twitter.com/>`_. It works with Python version 2.6+. Python 3 support is under development.
15-
16-
`Twitter <http://twitter.com>`_ provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a `web services API <http://dev.twitter.com/doc>`_ and this library is intended to make it even easier for Python programmers to use.
17-
18-
19-
Building
20-
--------
21-
From source:
22-
23-
Install the dependencies:
24-
25-
- `Requests <http://docs.python-requests.org/en/latest/>`_
26-
- `Requests OAuthlib <https://requests-oauthlib.readthedocs.org/en/latest/>`_
27-
28-
Alternatively use `pip`::
29-
30-
$ pip install -r requirements.txt
31-
32-
Download the latest `python-twitter` library from: http://code.google.com/p/python-twitter/
33-
34-
Extract the source distribution and run::
35-
36-
$ python setup.py build
37-
$ python setup.py install
38-
399

40-
Testing
41-
-------
42-
With setuptools installed::
10+
Contents:
4311

44-
$ python setup.py test
45-
46-
47-
Without setuptools installed::
48-
49-
$ python twitter_test.py
50-
51-
52-
Getting the code
53-
----------------
54-
The code is hosted at `Github <https://github.com/bear/python-twitter>`_.
55-
56-
Check out the latest development version anonymously with::
12+
.. toctree::
13+
:maxdepth: 1
5714

58-
$ git clone git://github.com/bear/python-twitter.git
59-
$ cd python-twitter
15+
installation.rst
16+
getting_started.rst
17+
migration_v30.rst
18+
models.rst
19+
searching.rst
20+
with_django.rst
21+
twitter.rst
6022

6123

62-
.. toctree::
63-
:maxdepth: 2
24+
Introduction
25+
------------
26+
This library provides a pure Python interface for the `Twitter API <https://dev.twitter.com/>`_. It works with Python 2.7+ and Python 3.
6427

28+
`Twitter <http://twitter.com>`_ provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a `web services API <http://dev.twitter.com/doc>`_ and this library is intended to make it even easier for Python programmers to use.
6529

6630

6731
Indices and tables
@@ -70,4 +34,3 @@ Indices and tables
7034
* :ref:`genindex`
7135
* :ref:`modindex`
7236
* :ref:`search`
73-

doc/installation.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Installation & Testing
2+
------------
3+
4+
Installation
5+
============
6+
7+
**From PyPI** ::
8+
9+
$ pip install python-twitter
10+
11+
12+
**From source**
13+
14+
Install the dependencies:
15+
16+
- `Requests <http://docs.python-requests.org/en/latest/>`_
17+
- `Requests OAuthlib <https://requests-oauthlib.readthedocs.org/en/latest/>`_
18+
19+
Alternatively use `pip`::
20+
21+
$ pip install -r requirements.txt
22+
23+
Download the latest `python-twitter` library from: https://github.com/bear/python-twitter/
24+
25+
Extract the source distribution and run::
26+
27+
$ python setup.py build
28+
$ python setup.py install
29+
30+
31+
Testing
32+
=======
33+
34+
Run::
35+
36+
$ python test.py
37+
38+
If you would like to see coverage information and have `Nose <https://nose.readthedocs.org>`_ installed::
39+
40+
$ nosetests --with-coverage
41+
42+
43+
Getting the code
44+
================
45+
46+
The code is hosted at `Github <https://github.com/bear/python-twitter>`_.
47+
48+
Check out the latest development version anonymously with::
49+
50+
$ git clone git://github.com/bear/python-twitter.git
51+
$ cd python-twitter

0 commit comments

Comments
 (0)