Give user option to bypass verification
This allows a user to use the python client with a storyboard instance that has a self-signed certificate, such as https://storyboard-dev.openstack.org Change-Id: Id1b1fb7b1b3921b70b2fa6946f13d188dd88f64e
This commit is contained in:
		@@ -26,12 +26,13 @@ DEFAULT_API_URL = "https://storyboard.openstack.org/api/v1"
 | 
			
		||||
 | 
			
		||||
class BaseClient(client.BaseClient):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, api_url=None, access_token=None):
 | 
			
		||||
    def __init__(self, api_url=None, access_token=None, verify=True):
 | 
			
		||||
        if not api_url:
 | 
			
		||||
            api_url = DEFAULT_API_URL
 | 
			
		||||
 | 
			
		||||
        self.auth_plugin = oauth.OAuthPlugin(api_url, access_token)
 | 
			
		||||
        self.http_client = BaseHTTPClient(auth_plugin=self.auth_plugin)
 | 
			
		||||
        self.http_client = BaseHTTPClient(auth_plugin=self.auth_plugin,
 | 
			
		||||
                                          verify=verify)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BaseHTTPClient(client.HTTPClient):
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ class Client(base.BaseClient):
 | 
			
		||||
                                   "mytoken")
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self, api_url=None, access_token=None):
 | 
			
		||||
    def __init__(self, api_url=None, access_token=None, verify=True):
 | 
			
		||||
        """Sets up a client with endpoint managers.
 | 
			
		||||
 | 
			
		||||
        :param api_url: (Optional) Full API url. Defaults to
 | 
			
		||||
@@ -50,11 +50,12 @@ class Client(base.BaseClient):
 | 
			
		||||
        :param access_token: (Optional) OAuth2 access token. If skipped only
 | 
			
		||||
        public read-only endpoint will be available. All other requests will
 | 
			
		||||
        fail with Unauthorized error.
 | 
			
		||||
        :param verify: (Optional) Check certificate. Defaults to `True`; set
 | 
			
		||||
         to `False` if accessing a trusted instance with a self-signed cert.
 | 
			
		||||
        :return: a client instance.
 | 
			
		||||
        """
 | 
			
		||||
        super(Client, self).__init__(api_url=api_url,
 | 
			
		||||
                                     access_token=access_token)
 | 
			
		||||
 | 
			
		||||
                                     access_token=access_token, verify=verify)
 | 
			
		||||
        self.branches = branches.BranchesManager(self)
 | 
			
		||||
        self.tasks = tasks.TasksManager(self)
 | 
			
		||||
        self.teams = teams.TeamsManager(self)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user