X Tutup
Skip to content

Commit b8aee02

Browse files
committed
Merge pull request bear#309 from bear/docs-config-two
Documentation update
2 parents 80b747b + 2e692ec commit b8aee02

34 files changed

+182
-6971
lines changed

README.rst

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ By the `Python-Twitter Developers <python-twitter@googlegroups.com>`_
2424
Introduction
2525
============
2626

27-
This library provides a pure Python interface for the `Twitter API <https://dev.twitter.com/>`_. It works with Python versions from 2.6+. Python 3 support is under development.
27+
This library provides a pure Python interface for the `Twitter API <https://dev.twitter.com/>`_. It works with Python versions from 2.7+ and Python 3.
2828

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

@@ -47,64 +47,83 @@ Check out the latest development version anonymously with::
4747
$ git clone git://github.com/bear/python-twitter.git
4848
$ cd python-twitter
4949

50-
Setup a virtual environment and install dependencies:
50+
To install dependencies, run either::
5151

52-
$ make env
52+
$ make dev
5353

54-
Activate the virtual environment created:
54+
or::
5555

56-
$ source env/bin/activate
56+
$ pip install -r requirements.testing.txt
57+
58+
To install the minimal dependencies for production use (i.e., what is installed
59+
with ``pip install python-twitter``) run::
60+
61+
$ make env
62+
63+
or::
64+
65+
$ pip install -r requirements.txt
5766

5867
=============
5968
Running Tests
6069
=============
61-
Note that tests require ```pip install nose``` and optionally ```pip install coverage```:
70+
Note that tests require ```pip install pytest``` and optionally ```pip install pytest-cov``` (these are included if you have installed dependencies from ```requirements.testing.txt```)
6271

63-
To run the unit tests:
72+
To run the unit tests::
6473

65-
$ make test
74+
$ make test
6675

67-
to also run code coverage:
76+
to also run code coverage::
6877

6978
$ make coverage
7079

80+
7181
=============
7282
Documentation
7383
=============
7484

75-
View the last release API documentation at: https://dev.twitter.com/overview/documentation
85+
View the latest python-twitter documentation at
86+
https://python-twitter.readthedocs.org. You can view Twitter's API documentation at: https://dev.twitter.com/overview/documentation
7687

7788
=====
7889
Using
7990
=====
8091

81-
The library provides a Python wrapper around the Twitter API and the Twitter data model.
92+
The library provides a Python wrapper around the Twitter API and the Twitter data model. To get started, check out the examples in the examples/ folder or read the documentation at https://python-twitter.readthedocs.org which contains information about getting your authentication keys from Twitter and using the library.
8293

8394
----
8495
Using with Django
8596
----
8697

8798
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
8899

89-
-----
90-
Model
91-
-----
100+
------
101+
Models
102+
------
92103

93-
The three model classes are ``twitter.Status``, ``twitter.User``, and ``twitter.DirectMessage``. The API methods return instances of these classes.
104+
The library utilizes models to represent various data structures returned by Twitter. Those models are:
105+
* twitter.Category
106+
* twitter.DirectMessage
107+
* twitter.Hashtag
108+
* twitter.List
109+
* twitter.Media
110+
* twitter.Status
111+
* twitter.Trend
112+
* twitter.Url
113+
* twitter.User
114+
* twitter.UserStatus
94115

95-
To read the full API for ``twitter.Status``, ``twitter.User``, or ``twitter.DirectMessage``, run::
116+
To read the documentation for any of these models, run::
96117

97-
$ pydoc twitter.Status
98-
$ pydoc twitter.User
99-
$ pydoc twitter.DirectMessage
118+
$ pydoc twitter.[model]
100119

101120
---
102121
API
103122
---
104123

105124
The API is exposed via the ``twitter.Api`` class.
106125

107-
The python-twitter library now only supports OAuth authentication as the Twitter devs have indicated that OAuth is the only method that will be supported moving forward.
126+
The python-twitter requires the use of OAuth keys for nearly all operations. As of Twitter's API v1.1, authentication is required for most, if not all, endpoints. Therefore, you will need to register an app with Twitter in order to use this library. Please see the "Getting Started" guide on https://python-twitter.readthedocs.org for a more information.
108127

109128
To generate an Access Token you have to pick what type of access your application requires and then do one of the following:
110129

@@ -129,40 +148,46 @@ To see if your credentials are successful::
129148

130149
**NOTE**: much more than the small sample given here will print
131150

132-
To fetch a single user's public status messages, where ``user`` is a Twitter *short name*::
151+
To fetch a single user's public status messages, where ``user`` is a Twitter user's screen name::
133152

134153
>>> statuses = api.GetUserTimeline(screen_name=user)
135154
>>> print([s.text for s in statuses])
136155

137-
To fetch a list a user's friends (requires authentication)::
156+
To fetch a list a user's friends::
138157

139158
>>> users = api.GetFriends()
140159
>>> print([u.name for u in users])
141160

142-
To post a Twitter status message (requires authentication)::
161+
To post a Twitter status message::
143162

144163
>>> status = api.PostUpdate('I love python-twitter!')
145164
>>> print(status.text)
146165
I love python-twitter!
147166

148-
There are many more API methods, to read the full API documentation::
167+
There are many more API methods, to read the full API documentation either
168+
check out the documentation on `readthedocs
169+
<https://python-twitter.readthedocs.org>`_, build the documentation locally
170+
with::
149171

150-
$ pydoc twitter.Api
172+
$ make docs
151173

174+
or check out the inline documentation with::
152175

176+
$ pydoc twitter.Api
153177

154178
----
155179
Todo
156180
----
157181

158-
Patches and bug reports are `welcome <https://github.com/bear/python-twitter/issues/new>`_, just please keep the style consistent with the original source.
182+
Patches, pull requests, and bug reports are `welcome <https://github.com/bear/python-twitter/issues/new>`_, just please keep the style consistent with the original source.
159183

160-
Add more example scripts.
184+
In particular, having more example scripts would be a huge help. If you have
185+
a program that uses python-twitter and would like a link in the documentation,
186+
submit a pull request against ``twitter/doc/getting_started.rst`` and add your
187+
program at the bottom.
161188

162189
The twitter.Status and ``twitter.User`` classes are going to be hard to keep in sync with the API if the API changes. More of the code could probably be written with introspection.
163190

164-
Statement coverage of ``twitter_test`` is only about 80% of twitter.py.
165-
166191
The ``twitter.Status`` and ``twitter.User`` classes could perform more validation on the property setters.
167192

168193
----------------
@@ -183,7 +208,7 @@ Now it's a full-on open source project with many contributors over time. See AUT
183208
License
184209
-------
185210

186-
| Copyright 2007-2014 The Python-Twitter Developers
211+
| Copyright 2007-2016 The Python-Twitter Developers
187212
|
188213
| Licensed under the Apache License, Version 2.0 (the 'License');
189214
| you may not use this file except in compliance with the License.
-4.76 KB
Binary file not shown.

doc/_build/doctrees/index.doctree

-16.9 KB
Binary file not shown.

doc/_build/html/.buildinfo

Lines changed: 0 additions & 4 deletions
This file was deleted.

doc/_build/html/_sources/index.txt

Lines changed: 0 additions & 78 deletions
This file was deleted.
-673 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
X Tutup