Skip to content

Instantly share code, notes, and snippets.

@guyjacks
Created December 27, 2017 04:20
Show Gist options
  • Save guyjacks/16497e00bb2acdd61abae5812b66b77c to your computer and use it in GitHub Desktop.
Save guyjacks/16497e00bb2acdd61abae5812b66b77c to your computer and use it in GitHub Desktop.
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