Subsitute api_table for functions #211

Closed
opened 2013-05-31 18:39:06 -07:00 by michaelhelmick · 0 comments
michaelhelmick commented 2013-05-31 18:39:06 -07:00 (Migrated from github.com)

Alright, so I use a typeahead in Sublime Text so when I have a Twython instance, it lets me see functions I can use. So when I do

from twython import Twython
t = Twython()
t.g

When I type g it gives me options:
screenshot

So you see it gives me those options. But it doesn't give me
get_home_timeline or get_user_timeline with options.

My idea is to not clutter twython's core api with the functions, keep them in endpoints.py but make them real python definitions and then make them part of the Twython class.

This will:

  1. Allow for typeaheads to catch these functions
  2. In our new ReadTheDocs, allow for a "endpoints" section in the developer interface and for people who find it hard to flip between Twython API and Twitter API trying to match up functions with accepted params, give them a one stop spot for the information

endpoints.py:

class Blah():
    def update_status(self, status, **params):
        """Update a status
        :param status: (required) The text of the status you want to send
        :param in_reply_to_status_id: (optional) The id of the status you want to reply to
        and so on......

        return api.post('stauses/update.json', **params)
        """

    def get_home_timeline(self):
    ...

The user would virtually see no difference in the Twython API and we'd still have all the endpoints separated

Alright, so I use a typeahead in Sublime Text so when I have a Twython instance, it lets me see functions I can use. So when I do ``` python from twython import Twython t = Twython() t.g ``` When I type `g` it gives me options: ![screenshot](http://s23.postimg.org/wfdshzv8b/Screen_Shot_2013_05_31_at_9_28_27_PM.png) So you see it gives me those options. But it doesn't give me `get_home_timeline` or `get_user_timeline` with options. My idea is to not clutter twython's core api with the functions, keep them in `endpoints.py` but make them real python definitions and then make them part of the Twython class. This will: 1. Allow for typeaheads to catch these functions 2. In our new ReadTheDocs, allow for a "endpoints" section in the developer interface and for people who find it hard to flip between Twython API and Twitter API trying to match up functions with accepted params, give them a one stop spot for the information `endpoints.py`: ``` python class Blah(): def update_status(self, status, **params): """Update a status :param status: (required) The text of the status you want to send :param in_reply_to_status_id: (optional) The id of the status you want to reply to and so on...... return api.post('stauses/update.json', **params) """ def get_home_timeline(self): ... ``` The user would virtually see no difference in the Twython API and we'd still have all the endpoints separated
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#211
No description provided.