From 5e2979b8709243954e075d6fe5a24ed89a6ba652 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 24 Jun 2013 15:48:32 -0400 Subject: [PATCH] [manual] Change API URLs to be based on api.humbughq.com/api. This must be deployed after we update our running nginx configuration to serve api.humbughq.com. (imported from commit b5c34ebdd595f55eecd6dca6a18a37f105107bd5) --- bots/check-mirroring | 2 +- bots/feedback-bot | 4 ++-- bots/zephyr_mirror_backend.py | 2 +- examples/curl-examples | 5 ++--- humbug/__init__.py | 6 ++++-- integrations/git/humbug_git_config.py | 2 +- integrations/svn/humbug_svn_config.py | 2 +- integrations/trac/humbug_trac_config.py | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bots/check-mirroring b/bots/check-mirroring index 7b91c95..e3530bd 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -15,7 +15,7 @@ parser.add_option('--verbose', action='store_true') parser.add_option('--site', dest='site', - default="https://humbughq.com", + default="https://api.humbughq.com", action='store') parser.add_option('--sharded', default=False, diff --git a/bots/feedback-bot b/bots/feedback-bot index b43a268..1051301 100755 --- a/bots/feedback-bot +++ b/bots/feedback-bot @@ -36,12 +36,12 @@ prod_client = humbug.Client( email="feedback@humbughq.com", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", verbose=True, - site="https://humbughq.com") + site="https://api.humbughq.com") staging_client = humbug.Client( email="feedback@humbughq.com", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", verbose=True, - site="https://staging.humbughq.com") + site="https://staging.humbughq.com/api") def forward_message(message): if message["type"] != "private" or len(message["display_recipient"]) != 2: diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 419affa..5f3bf65 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -70,7 +70,7 @@ class RandomExponentialBackoff(CountingBackoff): print message time.sleep(delay) -DEFAULT_SITE = "https://humbughq.com" +DEFAULT_SITE = "https://api.humbughq.com" class States: Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4) diff --git a/examples/curl-examples b/examples/curl-examples index 6d39afc..033c0b6 100755 --- a/examples/curl-examples +++ b/examples/curl-examples @@ -1,14 +1,13 @@ #!/bin/sh # Two quick API tests using curl -curl https://humbughq.com/api/v1/send_message \ +curl https://api.humbughq.com/v1/send_message \ -d "api-key=BOT_API_KEY" \ -d "email=BOT_EMAIL" \ -d "type=private" -d "content=test" \ -d "to=RECIPIENT_EMAIL" -curl https://humbughq.com/api/v1/get_messages \ +curl https://api.humbughq.com/v1/get_messages \ -d "api-key=BOT_API_KEY" \ -d "email=BOT_EMAIL" -# Or replace https://humbughq.com with your local test instance diff --git a/humbug/__init__.py b/humbug/__init__.py index 10971ec..aa0a705 100644 --- a/humbug/__init__.py +++ b/humbug/__init__.py @@ -41,7 +41,7 @@ assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1')) # In newer versions, the 'json' attribute is a function, not a property requests_json_is_function = callable(requests.Response.json) -API_VERSTRING = "/api/v1/" +API_VERSTRING = "/v1/" def generate_option_group(parser): group = optparse.OptionGroup(parser, 'API configuration') @@ -94,7 +94,9 @@ class Client(object): site = "https://" + site self.base_url = site else: - self.base_url = "https://humbughq.com" + self.base_url = "https://api.humbughq.com" + if self.base_url != "https://api.humbughq.com" and not self.base_url.endswith("/api"): + self.base_url += "/api" self.retry_on_errors = retry_on_errors self.client_name = client diff --git a/integrations/git/humbug_git_config.py b/integrations/git/humbug_git_config.py index 3e0cda3..6d5517c 100644 --- a/integrations/git/humbug_git_config.py +++ b/integrations/git/humbug_git_config.py @@ -54,4 +54,4 @@ def commit_notice_destination(repo, branch, commit): HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com" diff --git a/integrations/svn/humbug_svn_config.py b/integrations/svn/humbug_svn_config.py index 4de0376..814ae94 100644 --- a/integrations/svn/humbug_svn_config.py +++ b/integrations/svn/humbug_svn_config.py @@ -54,4 +54,4 @@ def commit_notice_destination(path, commit): HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com" diff --git a/integrations/trac/humbug_trac_config.py b/integrations/trac/humbug_trac_config.py index 4b2d0f9..af646f1 100644 --- a/integrations/trac/humbug_trac_config.py +++ b/integrations/trac/humbug_trac_config.py @@ -49,4 +49,4 @@ TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", HUMBUG_API_PATH = None # This should not need to change unless you have a custom Humbug subdomain. -HUMBUG_SITE = "https://humbughq.com" +HUMBUG_SITE = "https://api.humbughq.com"