Skip to content

API reference

pradyun edited this page Apr 23, 2013 · 7 revisions

Note: All functions and methods return None unless specified.

Classes

Hierarchy of classes:

To be implemented very soon (hopefully)

  • Access_Token
  • Me

Base

  • uid
    • The Unique ID (num) of the data the instance refers to.
  • site
    • The site this object is on
  • get_info(self, *args, **kwargs)
    • Gets and loads the data about itself from a dict as the first (and only) argument or gets it from the API.
  • set_args(self, dic)
    • Sets the arguments from the dic(<type 'dict'>), such that elf.key = value for every key, value in dic.

Post(Base)

This class has post-specific methods and variables

  • comments
    • Holds the Comment on this Post
  • set_args(self, dic)
    • Same as Base's et_args but the owner is a User instance.
  • get_comments(self)
    • Gets the Comment on this Post

Question(Post)

This class has 1 question-specific method and variable, for answers:

  • answers
    • List of Answer to this Question
  • get_answers(self)
    • Load Answer into answers

Site(Base)

This class has 1 site-specific method and variable, for questions:

  • questions
    • List of Question` on this Site
  • get_questions(self, **kwargs)
    • Load Question into questions

The following classes have no special methods or variables

  • Comment(Base) - A comment on a Post
  • Answer(Post) - An answer to a Question
  • Tag(Base) - A tag
  • Badge(Base) - A badge
  • User(Base) - An user

Functions

Backend

The functions listed here are used by the classes above. These would usually not be used in your program (unless you decide to implement your own class).

  • get_dict(url) => dict
    • Returns the dictionary of the response from url
    • This function return the API response from url
  • make_url(base, kargs={}, **kwargs) => str
    • Creates a url from base and keywords
    • This function is used to add the kwargs to the url (which are needed by the API)

Frontend

The functions listed here are (mostly) not used by the classes above. These do "global" work, like Proxy Handling, Authenticating

  • authenticate()
    • Not fully implemented Don't use!!
  • get_sites() => dict
    • Returns a dict in the form of name:api_site_name of all sites on SE
  • make_auth_proxy(proxy=None) => True
    • Allows for connection through authenticated proxy
  • make_proxy(proxy=None) => True
    • Allows for connection through proxy

Clone this wiki locally