Skip to content

Commit 2771038

Browse files
committed
2 parents acea37f + d0462e9 commit 2771038

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sugarcrm/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
class Client(object):
1010
def __init__(self, url, username, password, app='sugarcrm-python', lang='en_US', verify=True, session=None):
1111
if not url.endswith('/service/v4_1/rest.php'):
12+
if not url.endswith('/'):
13+
url += '/'
1214
url += 'service/v4_1/rest.php'
1315
self.url = url + '?'
1416
self.username = username
@@ -17,8 +19,10 @@ def __init__(self, url, username, password, app='sugarcrm-python', lang='en_US',
1719
self.lang = lang
1820
self.verify = verify
1921
self.session = session
20-
21-
response = self._login()
22+
try:
23+
response = self._login()
24+
except requests.exceptions.InvalidSchema:
25+
raise exception.InvalidURL("Please check your url '{0}' has a valid schema: 'http://', 'https://'".format(response.url))
2226
self.session_id = response['id']
2327

2428
def _login(self):

0 commit comments

Comments
 (0)