From 0d86f2ff01e0c37b8e63e8c54c4aa59a87f9044a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 14 Feb 2011 03:29:11 -0500 Subject: [PATCH] Account API setup --- convore/core.py | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/convore/core.py b/convore/core.py index d0caaf6..2247321 100644 --- a/convore/core.py +++ b/convore/core.py @@ -19,11 +19,26 @@ __author__ = 'Kenneth Reitz' __license__ = 'ISC' __copyright__ = 'Copyright 2011 Kenneth Reitz' - +__all__ = ['Convore'] API_URL = 'https://convore.com/api/' +class Account(object): + """Account API""" + + def verify(self): + """Authenticates. Returns True if authentication is successful, + False if not.""" + + r = requests.get(API_URL + 'account/verify.json') + return True if r.status_code == 200 else False + + +class Groups(object): + pass + + class Convore(object): """The :class:`Convore` object is the heart of this api wrapper. It provides all core functionality. @@ -33,31 +48,13 @@ class Convore(object): """ + account = Account() + groups = Groups() + + def __init__(self, username, password): self.username = username self.password = password requests.add_autoauth(API_URL, requests.AuthObject(self.username, self.password)) - self.verify() - - def verify(self): - """Authenticates. Returns True if authentication is successful, False if not.""" - - r = requests.get(API_URL + 'account/verify.json') - - return True if r.status_code == 200 else False - - -class Groups(object): - def create(self): - pass - - -class Group(object): - pass - def __init__(self, id): - pass - - def leave(self): - pass