(self, url, method='GET', params={}, headers={}, stream=False, raw=False)
import logging
        import http.client
        http.client.HTTPConnection.debuglevel = 1
        logging.basicConfig()
        logging.getLogger().setLevel(logging.DEBUG)
        req_log = logging.getLogger('requests.packages.urllib3')
        req_log.setLevel(logging.DEBUG)
        req_log.propagate = True
import logging
        import http.client
        http.client.HTTPConnection.debuglevel = 1
        logging.basicConfig()
        logging.getLogger().setLevel(logging.DEBUG)
        req_log = logging.getLogger('requests.packages.urllib3')
        req_log.setLevel(logging.DEBUG)
        req_log.propagate = True
import logging import http . client http . client . HTTPConnection . debuglevel = 1 logging . basicConfig () logging . getLogger () . setLevel ( logging . DEBUG ) req_log = logging . getLogger ( requests . packages . urllib3 ) req_log . setLevel ( logging . DEBUG ) req_log . propagate = True
def _request(self, url, method='GET', params={}, headers={}, stream=False, raw=False):

        ## uncomment for debug logging
        """
        import logging
        import http.client
        http.client.HTTPConnection.debuglevel = 1
        logging.basicConfig()
        logging.getLogger().setLevel(logging.DEBUG)
        req_log = logging.getLogger('requests.packages.urllib3')
        req_log.setLevel(logging.DEBUG)
        req_log.propagate = True
        """

        if method == 'GET':
            #print('COOKIES: ', self.session.cookies.get_dict())
            r = self.session.get(url, params=params, headers=headers, stream=stream)
            r.raise_for_status()
            if stream is True:
                return r
        elif method == 'PUT':
            r = self.session.put(url, json=params, headers=headers)
            r.raise_for_status()
        elif method == 'POST':
            r = self.session.post(url, json=params, headers=headers)
            r.raise_for_status()
        elif method == 'OPTIONS':
            r = self.session.options(url, headers=headers)
            r.raise_for_status()
            return

        body = r.json()

        if raw:
            return body
        else:
            if ('success' in body and body['success'] == True) or ('meta' in body and body['meta']['code'] == 200):
                if 'data' in body:
                    return body['data']
            else:
                raise HTTPError('Request ({0} {1}) failed: {2}'.format(method, url, r.json()), response=r)
def _request ( self , url , method = 'GET' , params = { } , headers = { } , stream = False , raw = False ) : ## uncomment for debug logging if method == 'GET' : #print('COOKIES: ', self.session.cookies.get_dict()) r = self . session . get ( url , params = params , headers = headers , stream = stream ) r . raise_for_status ( ) if stream is True : return r elif method == 'PUT' : r = self . session . put ( url , json = params , headers = headers ) r . raise_for_status ( ) elif method == 'POST' : r = self . session . post ( url , json = params , headers = headers ) r . raise_for_status ( ) elif method == 'OPTIONS' : r = self . session . options ( url , headers = headers ) r . raise_for_status ( ) return body = r . json ( ) if raw : return body else : if ( 'success' in body and body [ 'success' ] == True ) or ( 'meta' in body and body [ 'meta' ] [ 'code' ] == 200 ) : if 'data' in body : return body [ 'data' ] else : raise HTTPError ( 'Request ({0} {1}) failed: {2}' . format ( method , url , r . json ( ) ) , response = r )