Commit 22e701be authored by ryanss's avatar ryanss
Browse files

Merge pull request #2 from mdauphin/master

Add `verify` parameter to Session constructor
parents ddd3d291 fba5c633
......@@ -21,11 +21,13 @@ import requests
class Session:
def __init__(self, url, username, password, app="Python", lang="en_us"):
def __init__(self, url, username, password, app="Python", lang="en_us",
verify=True):
self.url = url
self.username = username
self.application = app
self.language = lang
self.verify = verify
result = self.login(username, password)
self.session_id = result['id']
......@@ -34,9 +36,9 @@ class Session:
'method': method,
'input_type': "JSON",
'response_type': "JSON",
'rest_data': json.dumps(params)
'rest_data': json.dumps(params),
}
r = requests.post(self.url, data=data)
r = requests.post(self.url, data=data, verify=self.verify)
if r.status_code == 200:
return json.loads(r.text.replace("'", "'"))
raise SugarError("SugarCRM API _request returned status code %d (%s)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment