Created
December 27, 2017 04:20
-
-
Save guyjacks/16497e00bb2acdd61abae5812b66b77c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def _url(path): | |
return 'https://api.pandapay.io/v1' + path | |
class ClientBase(object): | |
def __init__(self, auth): | |
self.auth = auth | |
def request(method, url, **kwargs): | |
return getattr(requests, method)(_url(url), data=kwargs, auth=auth).json | |
def get(url): | |
return self.request('get', url, **kwargs) | |
def create(): | |
return self.request('post', url, **kwargs) | |
def update(): | |
return self.request('put', url, **kwargs) | |
class Client(object): | |
def __init__(self, key): | |
auth = (key) | |
self.customers = ClientBase(auth) | |
self.donations = ClientBase(auth) | |
self.grants = ClientBase(auth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment