(
            self, base_url, basic_auth=False, username=None, password=None,
            request_data_type='json', return_for_status=[])
Pass username and password as None when basic auth is disabled
Pass username and password as None when basic auth is disabled
Pass username and password as None when basic auth is disabled
def __init__(
            self, base_url, basic_auth=False, username=None, password=None,
            request_data_type='json', return_for_status=[]):
        """Pass username and password as None when basic auth is disabled"""
        self.rest_url = base_url
        self.basic_auth = None
        self.request_data_type = request_data_type
        if return_for_status and not isinstance(return_for_status, list):
            return_for_status = [return_for_status]
        self.return_for_status = return_for_status

        if basic_auth is True:
            if password is None or username is None:
                raise RestClientException(
                    '`username` and `password` are required when `basic_auth` is True'
                )
            self.basic_auth = requests.auth.HTTPBasicAuth(username, password)
def __init__ ( self , base_url , basic_auth = False , username = None , password = None , request_data_type = 'json' , return_for_status = [ ] ) : self . rest_url = base_url self . basic_auth = None self . request_data_type = request_data_type if return_for_status and not isinstance ( return_for_status , list ) : return_for_status = [ return_for_status ] self . return_for_status = return_for_status if basic_auth is True : if password is None or username is None : raise RestClientException ( '`username` and `password` are required when `basic_auth` is True' ) self . basic_auth = requests . auth . HTTPBasicAuth ( username , password )