tfchain/internal/HttpClient.py
def _http_request(self, url, data=None, headers=None, method=None, **kwargs):
        """
        utility function for sending an http request

        @url url of the request
        @data data to be sent with the request
        @headers headers to be sent with the request
        @method method by which we will send the request, get, post, ..

        :raises HTTPError when not able to make the request
        :raises Exception when receiving response code represent error

        :returns the response of calling the http request
        """
        url = self._updateUrlParams(url, **kwargs)
        data = data or kwargs.get('data', None)
        if data and isinstance(data, (dict, list)):
            data = urllib.parse.urlencode(data)
            data = data.encode('utf-8')
        request = urllib.request.Request(url, data=data)
        if headers:
            for key, value in list(headers.items()):
                request.add_header(key, value)
        if not method:
            method = 'POST' if data else 'GET'
        request.get_method = lambda: method
        try:
            resp = urllib.request.urlopen(request)
        except Exception as e:
            raise HTTPError(e, url)

        #if resp.code in STATUS_AUTH_REQ: raise AuthorizationError('Not logged in or token expired')
        if resp.code not in (STATUS_OK):
            raise Exception(
                'unexpected HTTP response status %s: %s' % resp.code, resp)
        return resp

        utility function for sending an http request

        @url url of the request
        @data data to be sent with the request
        @headers headers to be sent with the request
        @method method by which we will send the request, get, post, ..

        :raises HTTPError when not able to make the request
        :raises Exception when receiving response code represent error

        :returns the response of calling the http request
        
utility function for sending an http request
@url url of the request
@data data to be sent with the request
@headers headers to be sent with the request
@method method by which we will send the request, get, post.

:raises HTTPError when not able to make the request
:raises Exception when receiving response code represent error

:returns the response of calling the http request
utility function for sending an http request @url url of the request @data data to be sent with the request @headers headers to be sent with the request @method method by which we will send the request get post . : raises HTTPError when not able to make the request : raises Exception when receiving response code represent error : returns the response of calling the http request
def _http_request(self, url, data=None, headers=None, method=None, **kwargs):
        url = self._updateUrlParams(url, **kwargs)
        data = data or kwargs.get('data', None)
        if data and isinstance(data, (dict, list)):
            data = urllib.parse.urlencode(data)
            data = data.encode('utf-8')
        request = urllib.request.Request(url, data=data)
        if headers:
            for key, value in list(headers.items()):
                request.add_header(key, value)
        if not method:
            method = 'POST' if data else 'GET'
        request.get_method = lambda: method
        try:
            resp = urllib.request.urlopen(request)
        except Exception as e:
            raise HTTPError(e, url)
        if resp.code not in (STATUS_OK):
            raise Exception(
                'unexpected HTTP response status %s: %s' % resp.code, resp)
        return resp
def _http_request ( self , url , data = None , headers = None , method = None , ** kwargs ) : url = self . _updateUrlParams ( url , ** kwargs ) data = data or kwargs . get ( 'data' , None ) if data and isinstance ( data , ( dict , list ) ) : data = urllib . parse . urlencode ( data ) data = data . encode ( 'utf-8' ) request = urllib . request . Request ( url , data = data ) if headers : for key , value in list ( headers . items ( ) ) : request . add_header ( key , value ) if not method : method = 'POST' if data else 'GET' request . get_method = lambda : method try : resp = urllib . request . urlopen ( request ) except Exception as e : raise HTTPError ( e , url ) if resp . code not in ( STATUS_OK ) : raise Exception ( 'unexpected HTTP response status %s: %s' % resp . code , resp ) return resp
utility function for sending an http request
@url url of the request
@data data to be sent with the request
@headers headers to be sent with the request
@method method by which we will send the request, get, post, ..
utility function for sending an http request @url url of the request @data data to be sent with the request @headers headers to be sent with the request @method method by which we will send the request get post ..
"""
        utility function for sending an http request

        @url url of the request
        @data data to be sent with the request
        @headers headers to be sent with the request
        @method method by which we will send the request, get, post, ..

        :raises HTTPError when not able to make the request
        :raises Exception when receiving response code represent error

        :returns the response of calling the http request
        """ #if resp.code in STATUS_AUTH_REQ: raise AuthorizationError('Not logged in or token expired')
self
url
data
headers
method