def __init__(self, url, trustAllCerts=True): self.url = url self._apiVersion = 4 self._headers = {'X-API-Version': self._apiVersion, 'Accept': 'application/json', 'Content-Type': 'application/json' } self.isLoggedIn = False if url.lower().startswith('https') and trustAllCerts: self.trustAllCerts = True else: self.trustAllCerts = False RestClient.initSSL(self.trustAllCerts)
def __init__(self, url, trustAllCerts=True): self.url = url self._apiVersion = 4 self._headers = { "X-API-Version": self._apiVersion, "Accept": "application/json", "Content-Type": "application/json", } self.isLoggedIn = False if url.lower().startswith("https") and trustAllCerts: self.trustAllCerts = True else: self.trustAllCerts = False RestClient.initSSL(self.trustAllCerts)
def request(self, method, path, params=None): try: return RestClient.request(method, self.makeUrl(path), params, self._headers) except RestError, e: if verbose: print e if e.code == 400: raise NotLoggedInException(e) elif e.code >= 500: raise ServerException(e) raise e