|
| 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. |
0 commit comments