diff --git a/common.py b/common.py index 2b11521..b12baf2 100644 --- a/common.py +++ b/common.py @@ -3,6 +3,7 @@ import simplejson import requests import time import traceback +import urlparse # Check that we have a recent enough version assert(requests.__version__ > '0.12') @@ -19,7 +20,7 @@ class HumbugAPI(): request["api-key"] = self.api_key while True: try: - res = requests.post(self.base_url + url, data=request, verify=True) + res = requests.post(urlparse.urljoin(self.base_url, url), data=request, verify=True) if res.status_code == requests.codes.service_unavailable: # On 503 errors, try again after a short sleep time.sleep(0.5) diff --git a/examples/send-message b/examples/send-message index 003b914..e220a65 100755 --- a/examples/send-message +++ b/examples/send-message @@ -12,7 +12,7 @@ Example: send-message --user=tabbott@humbughq.com --site=http://127.0.0.1:8000 parser = optparse.OptionParser(usage=usage) parser.add_option('--site', dest='site', - default="https://app.humbughq.com/", + default="https://app.humbughq.com", action='store') parser.add_option('--api-key', dest='api_key', diff --git a/examples/subscribe b/examples/subscribe index 0615fcd..05f588d 100755 --- a/examples/subscribe +++ b/examples/subscribe @@ -12,7 +12,7 @@ Example: subscribe --user=tabbott@humbughq.com --site=http://127.0.0.1:8000 parser = optparse.OptionParser(usage=usage) parser.add_option('--site', dest='site', - default="https://app.humbughq.com/", + default="https://app.humbughq.com", action='store') parser.add_option('--api-key', dest='api_key',