def get_client(*access_token): """ Get oDesk Client instance """ try: key = current_app.config['ODESK_KEY'] secret = current_app.config['ODESK_SECRET'] except KeyError: raise Exception("ODESK_KEY and ODESK_SECRET were not found in app.config") c = Client(key, secret, auth='oauth') if access_token: c.oauth_access_token, c.oauth_access_token_secret = access_token elif ODESK_ACCESS_TOKEN in session: c.oauth_access_token, c.oauth_access_token_secret = session.get(ODESK_ACCESS_TOKEN, [None]*2) return c
def get_client(*access_token): """ Get oDesk Client instance """ try: key = current_app.config['ODESK_KEY'] secret = current_app.config['ODESK_SECRET'] except KeyError: raise Exception( "ODESK_KEY and ODESK_SECRET were not found in app.config") c = Client(key, secret, auth='oauth') if access_token: c.oauth_access_token, c.oauth_access_token_secret = access_token elif ODESK_ACCESS_TOKEN in session: c.oauth_access_token, c.oauth_access_token_secret = session.get( ODESK_ACCESS_TOKEN, [None] * 2) return c