labpack/handlers/requests.py
def _request(self, **kwargs):
        
        ''' a helper method for processing all request types '''
        
        response = None
        error = ''
        code = 0
        
    # send request
        from requests import request
        try:
            response = request(**kwargs)
        # handle response
            if self.handle_response:
                response, error, code = self.handle_response(response)
            else:
                code = response.status_code
    # handle errors
        except Exception as err:
            from requests import Request
            request_object = Request(**kwargs)
            try:
                request_details = self.handle_requests(request_object)
                error = request_details['error']
            except:
                error = str(err)
                
        return response, error, code
 a helper method for processing all request types 
a helper method for processing all request types
a helper method for processing all request types
def _request(self, **kwargs):
        response = None
        error = ''
        code = 0
        from requests import request
        try:
            response = request(**kwargs)
            if self.handle_response:
                response, error, code = self.handle_response(response)
            else:
                code = response.status_code
        except Exception as err:
            from requests import Request
            request_object = Request(**kwargs)
            try:
                request_details = self.handle_requests(request_object)
                error = request_details['error']
            except:
                error = str(err)
        return response, error, code
def _request ( self , ** kwargs ) : response = None error = '' code = 0 from requests import request try : response = request ( ** kwargs ) if self . handle_response : response , error , code = self . handle_response ( response ) else : code = response . status_code except Exception as err : from requests import Request request_object = Request ( ** kwargs ) try : request_details = self . handle_requests ( request_object ) error = request_details [ 'error' ] except : error = str ( err ) return response , error , code
a helper method for processing all request types
a helper method for processing all request types
''' a helper method for processing all request types ''' # send request
 # handle response
 # handle errors

self