Begin docs
[ci skip]
This commit is contained in:
parent
ec2bd7d686
commit
55641a1966
72 changed files with 26300 additions and 1 deletions
177
docs/_build/html/usage/basic_usage.html
vendored
Normal file
177
docs/_build/html/usage/basic_usage.html
vendored
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Basic Usage — Twython 3.0.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../',
|
||||
VERSION: '3.0.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<link rel="top" title="Twython 3.0.0 documentation" href="../index.html" />
|
||||
<link rel="next" title="Developer Interface" href="../api.html" />
|
||||
<link rel="prev" title="Starting Out" href="starting_out.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../api.html" title="Developer Interface"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="starting_out.html" title="Starting Out"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="basic-usage">
|
||||
<span id="id1"></span><h1>Basic Usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This section will cover how to use Twython and interact with some basic Twitter API calls</p>
|
||||
<p>Before you make any API calls, make sure you <a class="reference internal" href="starting_out.html#starting-out"><em>authenticated</em></a> the user!</p>
|
||||
<p>Create a Twython instance with your application keys and the users OAuth tokens:</p>
|
||||
<div class="highlight-python"><pre>from twython import Twython
|
||||
twitter = Twython(APP_KEY, APP_SECRET
|
||||
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)</pre>
|
||||
</div>
|
||||
<div class="admonition-important admonition">
|
||||
<p class="first admonition-title">Important</p>
|
||||
<p class="last">All sections on this page will assume you’re using a Twython instance</p>
|
||||
</div>
|
||||
<div class="section" id="what-twython-returns">
|
||||
<h2>What Twython Returns<a class="headerlink" href="#what-twython-returns" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Twython returns a dictionary of JSON response from Twitter</p>
|
||||
</div>
|
||||
<div class="section" id="user-information">
|
||||
<h2>User Information<a class="headerlink" href="#user-information" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Documentation: <a class="reference external" href="https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials">https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials</a></p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span><span class="o">.</span><span class="n">verify_credentials</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="authenticated-users-home-timeline">
|
||||
<h2>Authenticated Users Home Timeline<a class="headerlink" href="#authenticated-users-home-timeline" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Documentation: <a class="reference external" href="https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline">https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline</a></p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span><span class="o">.</span><span class="n">get_home_timeline</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="search">
|
||||
<h2>Search<a class="headerlink" href="#search" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Documentation: <a class="reference external" href="https://dev.twitter.com/docs/api/1.1/get/search/tweets">https://dev.twitter.com/docs/api/1.1/get/search/tweets</a></p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">q</span><span class="o">=</span><span class="s">'python'</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>To help explain <a class="reference internal" href="starting_out.html#starting-out"><em>dynamic function arguments</em></a> a little more, you can see that the previous call used the keyword argument <tt class="docutils literal"><span class="pre">q</span></tt>, that is because Twitter specifies in their <a class="reference external" href="https://dev.twitter.com/docs/api/1.1/get/search/tweets">search documentation</a> that the search call accepts the parameter “q”. You can pass mutiple keyword arguments. The search documentation also specifies that the call accepts the parameter “result_type”</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">q</span><span class="o">=</span><span class="s">'python'</span><span class="p">,</span> <span class="n">result_type</span><span class="o">=</span><span class="s">'popular'</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="updating-status">
|
||||
<h2>Updating Status<a class="headerlink" href="#updating-status" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Documentation: <a class="reference external" href="https://dev.twitter.com/docs/api/1/post/statuses/update">https://dev.twitter.com/docs/api/1/post/statuses/update</a></p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span><span class="o">.</span><span class="n">update_status</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">'See how easy using Twython is!'</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Basic Usage</a><ul>
|
||||
<li><a class="reference internal" href="#what-twython-returns">What Twython Returns</a></li>
|
||||
<li><a class="reference internal" href="#user-information">User Information</a></li>
|
||||
<li><a class="reference internal" href="#authenticated-users-home-timeline">Authenticated Users Home Timeline</a></li>
|
||||
<li><a class="reference internal" href="#search">Search</a></li>
|
||||
<li><a class="reference internal" href="#updating-status">Updating Status</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="starting_out.html"
|
||||
title="previous chapter">Starting Out</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../api.html"
|
||||
title="next chapter">Developer Interface</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../_sources/usage/basic_usage.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../api.html" title="Developer Interface"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="starting_out.html" title="Starting Out"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Ryan McGrath.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
154
docs/_build/html/usage/install.html
vendored
Normal file
154
docs/_build/html/usage/install.html
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Installation — Twython 3.0.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../',
|
||||
VERSION: '3.0.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<link rel="top" title="Twython 3.0.0 documentation" href="../index.html" />
|
||||
<link rel="next" title="Starting Out" href="starting_out.html" />
|
||||
<link rel="prev" title="Twython" href="../index.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="starting_out.html" title="Starting Out"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="Twython"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="installation">
|
||||
<span id="install"></span><h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Information on how to properly install Twython</p>
|
||||
<div class="section" id="pip-or-easy-install">
|
||||
<h2>Pip or Easy Install<a class="headerlink" href="#pip-or-easy-install" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Install Twython via <a class="reference external" href="http://www.pip-installer.org/">pip</a>:</p>
|
||||
<div class="highlight-python"><pre>$ pip install twython</pre>
|
||||
</div>
|
||||
<p>or, with <a class="reference external" href="http://pypi.python.org/pypi/setuptools">easy_install</a>:</p>
|
||||
<div class="highlight-python"><pre>$ easy_install twython</pre>
|
||||
</div>
|
||||
<p>But, hey... <a class="reference external" href="http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install">that’s up to you</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="source-code">
|
||||
<h2>Source Code<a class="headerlink" href="#source-code" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Twython is actively maintained on GitHub</p>
|
||||
<p>Feel free to clone the repository:</p>
|
||||
<div class="highlight-python"><pre>git clone git://github.com/ryanmcgrath/twython.git</pre>
|
||||
</div>
|
||||
<p><a class="reference external" href="https://github.com/ryanmcgrath/twython/tarball/master">tarball</a>:</p>
|
||||
<div class="highlight-python"><pre>$ curl -OL https://github.com/ryanmcgrath/twython/tarball/master</pre>
|
||||
</div>
|
||||
<p><a class="reference external" href="https://github.com/ryanmcgrath/twython/tarball/master">zipball</a>:</p>
|
||||
<div class="highlight-python"><pre>$ curl -OL https://github.com/ryanmcgrath/twython/zipball/master</pre>
|
||||
</div>
|
||||
<p>Now that you have the source code, install it into your site-packages directory:</p>
|
||||
<div class="highlight-python"><pre>$ python setup.py install</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Installation</a><ul>
|
||||
<li><a class="reference internal" href="#pip-or-easy-install">Pip or Easy Install</a></li>
|
||||
<li><a class="reference internal" href="#source-code">Source Code</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../index.html"
|
||||
title="previous chapter">Twython</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="starting_out.html"
|
||||
title="next chapter">Starting Out</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../_sources/usage/install.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="starting_out.html" title="Starting Out"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="Twython"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Ryan McGrath.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
128
docs/_build/html/usage/quickstart.html
vendored
Normal file
128
docs/_build/html/usage/quickstart.html
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Quickstart — Twython 3.0.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/bootstrap-2.3.1/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||||
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootswatch/2.3.1/flatly/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/bootstrap-2.3.1/css/bootstrap-responsive.min.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../',
|
||||
VERSION: '3.0.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="../_static/js/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
|
||||
<script type="text/javascript" src="../_static/bootstrap-2.3.1/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
|
||||
<link rel="top" title="Twython 3.0.0 documentation" href="../index.html" />
|
||||
<link rel="prev" title="Installation" href="install.html" />
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="navbar" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
|
||||
<button class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
|
||||
<a class="brand" href="../index.html">Twython</a>
|
||||
<span class="navbar-text pull-left"><b>3.0.0</b></span>
|
||||
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li class="dropdown globaltoc-container">
|
||||
<a href="../index.html"
|
||||
class="dropdown-toggle"
|
||||
data-toggle="dropdown">Site <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu globaltoc"
|
||||
><ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="">Quickstart</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Page <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu localtoc"><ul>
|
||||
<li><a class="reference internal" href="#">Quickstart</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li><a href="install.html"
|
||||
title="previous chapter">« Installation</a></li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="../_sources/usage/quickstart.txt"
|
||||
rel="nofollow">Source</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<form class="navbar-search pull-right" style="margin-bottom:-3px;" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="section" id="quickstart">
|
||||
<span id="id1"></span><h1>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h1>
|
||||
<span class="target" id="module-twython.api"></span><p>Eager</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="pull-right">
|
||||
<a href="#">Back to top</a>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
© Copyright 2013, Ryan McGrath.<br/>
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2b1.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
192
docs/_build/html/usage/starting_out.html
vendored
Normal file
192
docs/_build/html/usage/starting_out.html
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Starting Out — Twython 3.0.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../',
|
||||
VERSION: '3.0.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
<link rel="top" title="Twython 3.0.0 documentation" href="../index.html" />
|
||||
<link rel="next" title="Basic Usage" href="basic_usage.html" />
|
||||
<link rel="prev" title="Installation" href="install.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="basic_usage.html" title="Basic Usage"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="install.html" title="Installation"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="starting-out">
|
||||
<span id="id1"></span><h1>Starting Out<a class="headerlink" href="#starting-out" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This section is going to help you understand creating a Twitter Application, authenticating a user, and making basic API calls</p>
|
||||
<div class="section" id="beginning">
|
||||
<h2>Beginning<a class="headerlink" href="#beginning" title="Permalink to this headline">¶</a></h2>
|
||||
<p>First, you’ll want to head over to <a class="reference external" href="https://dev.twitter.com/apps">https://dev.twitter.com/apps</a> and register an application!</p>
|
||||
<p>After you register, grab your applications <tt class="docutils literal"><span class="pre">Consumer</span> <span class="pre">Key</span></tt> and <tt class="docutils literal"><span class="pre">Consumer</span> <span class="pre">Secret</span></tt> from the application details tab.</p>
|
||||
<p>Now you’re ready to start authentication!</p>
|
||||
</div>
|
||||
<div class="section" id="authentication">
|
||||
<h2>Authentication<a class="headerlink" href="#authentication" title="Permalink to this headline">¶</a></h2>
|
||||
<p>First, you’ll want to import Twython:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">twython</span> <span class="kn">import</span> <span class="n">Twython</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Now, you’ll want to create a Twython instance with your <tt class="docutils literal"><span class="pre">Consumer</span> <span class="pre">Key</span></tt> and <tt class="docutils literal"><span class="pre">Consumer</span> <span class="pre">Secert</span></tt></p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">APP_KEY</span> <span class="o">=</span> <span class="s">'YOUR_APP_KEY'</span>
|
||||
<span class="n">APP_SECET</span> <span class="o">=</span> <span class="s">'YOUR_APP_SECRET'</span>
|
||||
|
||||
<span class="n">twitter</span> <span class="o">=</span> <span class="n">Twython</span><span class="p">(</span><span class="n">APP_KEY</span><span class="p">,</span> <span class="n">APP_SECRET</span><span class="p">)</span>
|
||||
<span class="n">auth</span> <span class="o">=</span> <span class="n">twitter</span><span class="o">.</span><span class="n">get_authentication_tokens</span><span class="p">(</span><span class="n">callback_url</span><span class="o">=</span><span class="s">'http://mysite.com/callback'</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>From the <tt class="docutils literal"><span class="pre">auth</span></tt> variable, save the <tt class="docutils literal"><span class="pre">oauth_token_secret</span></tt> for later use. In Django or other web frameworks, you might want to store it to a session variable:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">OAUTH_TOKEN_SECRET</span> <span class="o">=</span> <span class="n">auth</span><span class="p">[</span><span class="s">'oauth_token_secret'</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Send the user to the authentication url, you can obtain it by accessing:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth</span><span class="p">[</span><span class="s">'auth_url'</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="handling-the-callback">
|
||||
<h2>Handling the Callback<a class="headerlink" href="#handling-the-callback" title="Permalink to this headline">¶</a></h2>
|
||||
<p>After they authorize your application to access some of their account details, they’ll be redirected to the callback url you specified in <tt class="docutils literal"><span class="pre">get_autentication_tokens</span></tt></p>
|
||||
<p>You’ll want to extract the <tt class="docutils literal"><span class="pre">oauth_token</span></tt> and <tt class="docutils literal"><span class="pre">oauth_verifier</span></tt> from the url.</p>
|
||||
<p>Django example:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">OAUTH_TOKEN</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="p">[</span><span class="s">'oauth_token'</span><span class="p">]</span>
|
||||
<span class="n">oauth_verifier</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="p">[</span><span class="s">'oauth_verifier'</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Now that you have the <tt class="docutils literal"><span class="pre">oauth_token</span></tt> and <tt class="docutils literal"><span class="pre">oauth_verifier</span></tt> stored to variables, you’ll want to create a new instance of Twython and grab the final user tokens:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">twitter</span> <span class="o">=</span> <span class="n">Twython</span><span class="p">(</span><span class="n">APP_KEY</span><span class="p">,</span> <span class="n">APP_SECRET</span><span class="p">,</span>
|
||||
<span class="n">OAUTH_TOKEN</span><span class="p">,</span> <span class="n">OAUTH_TOKEN_SECRET</span><span class="p">)</span>
|
||||
|
||||
<span class="n">final_step</span> <span class="o">=</span> <span class="n">twitter</span><span class="o">.</span><span class="n">get_authorized_tokens</span><span class="p">(</span><span class="n">oauth_verifier</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Once you have the final user tokens, store them in a database for later use!:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">OAUTH_TOKEN</span> <span class="o">=</span> <span class="n">final_step</span><span class="p">[</span><span class="s">'oauth_token'</span><span class="p">]</span>
|
||||
<span class="n">OAUTH_TOKEN_SECERT</span> <span class="o">=</span> <span class="n">final_step</span><span class="p">[</span><span class="s">'oauth_token_secret'</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="the-twython-api-table">
|
||||
<h2>The Twython API Table<a class="headerlink" href="#the-twython-api-table" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In the Twython package is a file called <tt class="docutils literal"><span class="pre">endpoints.py</span></tt> which holds a dictionary of all Twitter API endpoints. This is so Twython’s core <tt class="docutils literal"><span class="pre">api.py</span></tt> isn’t cluttered with 50+ methods. We dynamically register these funtions when a Twython object is initiated.</p>
|
||||
</div>
|
||||
<div class="section" id="dynamic-function-arguments">
|
||||
<h2>Dynamic Function Arguments<a class="headerlink" href="#dynamic-function-arguments" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Keyword arguments to functions are mapped to the functions available for each endpoint in the Twitter API docs. Doing this allows us to be incredibly flexible in querying the Twitter API, so changes to the API aren’t held up from you using them by this library.</p>
|
||||
<hr class="docutils" />
|
||||
<p>Now that you have your application tokens and user tokens, check out the <a class="reference internal" href="basic_usage.html#basic-usage"><em>basic usage</em></a> section.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Starting Out</a><ul>
|
||||
<li><a class="reference internal" href="#beginning">Beginning</a></li>
|
||||
<li><a class="reference internal" href="#authentication">Authentication</a></li>
|
||||
<li><a class="reference internal" href="#handling-the-callback">Handling the Callback</a></li>
|
||||
<li><a class="reference internal" href="#the-twython-api-table">The Twython API Table</a></li>
|
||||
<li><a class="reference internal" href="#dynamic-function-arguments">Dynamic Function Arguments</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="install.html"
|
||||
title="previous chapter">Installation</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="basic_usage.html"
|
||||
title="next chapter">Basic Usage</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../_sources/usage/starting_out.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="basic_usage.html" title="Basic Usage"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="install.html" title="Installation"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../index.html">Twython 3.0.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Ryan McGrath.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue