@@ -0,0 +1,1985 @@
+#! /usr/bin/env python2.7%0A%0Aimport requests%0A%0Aclass API(object):%0A    # This class should be inherited by more unique API specific classes%0A    # See kraken.py for an example%0A%0A    def __init__(self, base_url, default_headers):%0A        self.base_url = base_url%0A        self.headers = default_headers%0A%0A    # Define all HTTP verb calls%0A    # Each return the status of the call (True/False), and the return payload%0A    def get(self, endpoint, headers = None, **kwargs):%0A        if headers:%0A            # Update the base headers with any new headers%0A            # But w/o changing the base ones%0A            headers = self.update_headers(headers)%0A        url = self.base_url + endpoint%0A%0A        try:%0A            data = requests.get(url=url, headers=headers, **kwargs)%0A            data.raise_for_status()%0A            data_decode = data.json()%0A            return True, data_decode%0A        except requests.exceptions.HTTPError:%0A            return False, data%0A%0A    def post(self, endpoint, data, headers = None, **kwargs):%0A        if headers:%0A            headers = self.update_headers(headers)%0A        url = self.base_url + endpoint%0A%0A        try:%0A            data = requests.post(url=url, headers=headers, data=data, **kwargs)%0A            data.raise_for_status()%0A            data_decode = data.json()%0A            return True, data_decode%0A        except requests.exceptions.HTTPError:%0A            return False, data%0A%0A    def put(self, endpoint, data, headers = None, **kwargs):%0A        if headers:%0A            headers = self.update_headers(headers)%0A        url = self.base_url + endpoint%0A%0A        try:%0A            data = requests.put(url=url, headers=headers, data=data, **kwargs)%0A            data.raise_for_status()%0A            data_decode = data.json()%0A            return True, data_decode%0A        except requests.exceptions.HTTPError:%0A            return False, data%0A%0A    # Woker functions%0A    def update_headers(self, headers):%0A        tmp = self.headers.copy()%0A        return tmp.update(headers)%0A

move api base to folder