mflbackend/tests/test_search3.py
def call(url, params={}, data=None, is_json=True):
    """ Makes a GET call to the given host and path.
    """
    try:
        params = urllib.parse.urlencode(params)
        if params:
            url = '%s?%s' % (url, params)
        q = "%s/%s" % (host, url)
        user, pw = 'mfl', 'mfl'
        userpw = '%s:%s' % (user, pw)
        basic = base64.b64encode(userpw.encode())
        if data:
            data = data.encode()
        req = urllib.request.Request(q, data=data)
        req.add_header('Authorization', 'Basic %s' % basic.decode())

        print('send %s' % q)
        # print('headers %s' % req.headers)
        response = urllib.request.urlopen(req).read().decode('utf8')
        # print('reps', response)
        if is_json:
            response = json.loads(response)
        return q, response
    except:
        print('calling',host+url)
        raise
 Makes a GET call to the given host and path.
    
Makes a GET call to the given host and path.
Makes a GET call to the given host and path .
def call(url, params={}, data=None, is_json=True):
    try:
        params = urllib.parse.urlencode(params)
        if params:
            url = '%s?%s' % (url, params)
        q = "%s/%s" % (host, url)
        user, pw = 'mfl', 'mfl'
        userpw = '%s:%s' % (user, pw)
        basic = base64.b64encode(userpw.encode())
        if data:
            data = data.encode()
        req = urllib.request.Request(q, data=data)
        req.add_header('Authorization', 'Basic %s' % basic.decode())
        print('send %s' % q)
        response = urllib.request.urlopen(req).read().decode('utf8')
        if is_json:
            response = json.loads(response)
        return q, response
    except:
        print('calling',host+url)
        raise
def call ( url , params = { } , data = None , is_json = True ) : try : params = urllib . parse . urlencode ( params ) if params : url = '%s?%s' % ( url , params ) q = "%s/%s" % ( host , url ) user , pw = 'mfl' , 'mfl' userpw = '%s:%s' % ( user , pw ) basic = base64 . b64encode ( userpw . encode ( ) ) if data : data = data . encode ( ) req = urllib . request . Request ( q , data = data ) req . add_header ( 'Authorization' , 'Basic %s' % basic . decode ( ) ) print ( 'send %s' % q ) response = urllib . request . urlopen ( req ) . read ( ) . decode ( 'utf8' ) if is_json : response = json . loads ( response ) return q , response except : print ( 'calling' , host + url ) raise
Makes a GET call to the given host and path.
Makes a GET call to the given host and path .
""" Makes a GET call to the given host and path.
    """ # print('headers %s' % req.headers) # print('reps', response)
url
params
data
is_json