]> jfr.im git - z_archive/twitter.git/blob - twitter/__init__.py
Improve OAuth2 app-only code and documentation
[z_archive/twitter.git] / twitter / __init__.py
1 """
2 The minimalist yet fully featured Twitter API and Python toolset.
3
4 The Twitter and TwitterStream classes are the key to building your own
5 Twitter-enabled applications.
6
7 """
8
9 from textwrap import dedent
10
11 from .api import Twitter, TwitterError, TwitterHTTPError, TwitterResponse
12 from .auth import NoAuth, UserPassAuth
13 from .oauth import (
14 OAuth, read_token_file, write_token_file,
15 __doc__ as oauth_doc)
16 from .oauth2 import (
17 OAuth2, read_bearer_token_file, write_bearer_token_file,
18 __doc__ as oauth2_doc)
19 from .stream import TwitterStream
20 from .oauth_dance import oauth_dance, oauth2_dance
21
22 __doc__ = __doc__ or ""
23
24 __doc__ += """
25 The Twitter class
26 -----------------
27 """
28 __doc__ += dedent(Twitter.__doc__ or "")
29
30 __doc__ += """
31 The TwitterStream class
32 -----------------------
33 """
34 __doc__ += dedent(TwitterStream.__doc__ or "")
35
36
37 __doc__ += """
38 Twitter Response Objects
39 ------------------------
40 """
41 __doc__ += dedent(TwitterResponse.__doc__ or "")
42
43
44 __doc__ += """
45 Authentication
46 --------------
47
48 You can authenticate with Twitter in three ways: NoAuth, OAuth, or
49 OAuth2 (app-only). Get help() on these classes to learn how to use them.
50
51 OAuth and OAuth2 are probably the most useful.
52
53
54 Working with OAuth
55 ------------------
56 """
57
58 __doc__ += dedent(oauth_doc or "")
59
60 __doc__ += """
61 Working with OAuth2
62 -------------------
63 """
64
65 __doc__ += dedent(oauth2_doc or "")
66
67 __all__ = [
68 "NoAuth",
69 "OAuth",
70 "OAuth2",
71 "oauth2_dance",
72 "oauth_dance",
73 "read_bearer_token_file",
74 "read_token_file",
75 "Twitter",
76 "TwitterError",
77 "TwitterHTTPError",
78 "TwitterResponse",
79 "TwitterStream",
80 "UserPassAuth",
81 "write_bearer_token_file",
82 "write_token_file",
83 ]