[manual] Use api.zulip.com to access the Humbug API.
This needs to be deployed after the nginx configuration is deployed. (imported from commit 167a3d9d27595d40883bb400ebcc44c4ad9b6a2f)
This commit is contained in:
		
							parent
							
								
									d063efa8a0
								
							
						
					
					
						commit
						22e5a15bc4
					
				
					 10 changed files with 14 additions and 18 deletions
				
			
		| 
						 | 
					@ -15,7 +15,7 @@ parser.add_option('--verbose',
 | 
				
			||||||
                  action='store_true')
 | 
					                  action='store_true')
 | 
				
			||||||
parser.add_option('--site',
 | 
					parser.add_option('--site',
 | 
				
			||||||
                  dest='site',
 | 
					                  dest='site',
 | 
				
			||||||
                  default="https://api.humbughq.com",
 | 
					                  default="https://api.zulip.com",
 | 
				
			||||||
                  action='store')
 | 
					                  action='store')
 | 
				
			||||||
parser.add_option('--sharded',
 | 
					parser.add_option('--sharded',
 | 
				
			||||||
                  default=False,
 | 
					                  default=False,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,12 +36,12 @@ prod_client = humbug.Client(
 | 
				
			||||||
    email="feedback@zulip.com",
 | 
					    email="feedback@zulip.com",
 | 
				
			||||||
    api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 | 
					    api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 | 
				
			||||||
    verbose=True,
 | 
					    verbose=True,
 | 
				
			||||||
    site="https://api.humbughq.com")
 | 
					    site="https://api.zulip.com")
 | 
				
			||||||
staging_client = humbug.Client(
 | 
					staging_client = humbug.Client(
 | 
				
			||||||
    email="feedback@zulip.com",
 | 
					    email="feedback@zulip.com",
 | 
				
			||||||
    api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 | 
					    api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 | 
				
			||||||
    verbose=True,
 | 
					    verbose=True,
 | 
				
			||||||
    site="https://staging.humbughq.com/api")
 | 
					    site="https://staging.zulip.com/api")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def forward_message(message):
 | 
					def forward_message(message):
 | 
				
			||||||
    if message["type"] != "private" or len(message["display_recipient"]) != 2:
 | 
					    if message["type"] != "private" or len(message["display_recipient"]) != 2:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ class RandomExponentialBackoff(CountingBackoff):
 | 
				
			||||||
            print message
 | 
					            print message
 | 
				
			||||||
        time.sleep(delay)
 | 
					        time.sleep(delay)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFAULT_SITE = "https://api.humbughq.com"
 | 
					DEFAULT_SITE = "https://api.zulip.com"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class States:
 | 
					class States:
 | 
				
			||||||
    Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4)
 | 
					    Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +1,13 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
# Two quick API tests using curl
 | 
					# Two quick API tests using curl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
curl https://api.humbughq.com/v1/send_message \
 | 
					curl https://api.zulip.com/v1/send_message \
 | 
				
			||||||
    -d "api-key=BOT_API_KEY" \
 | 
					    -d "api-key=BOT_API_KEY" \
 | 
				
			||||||
    -d "email=BOT_EMAIL" \
 | 
					    -d "email=BOT_EMAIL" \
 | 
				
			||||||
    -d "type=private" -d "content=test" \
 | 
					    -d "type=private" -d "content=test" \
 | 
				
			||||||
    -d "to=RECIPIENT_EMAIL"
 | 
					    -d "to=RECIPIENT_EMAIL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
curl https://api.humbughq.com/v1/get_messages \
 | 
					curl https://api.zulip.com/v1/get_messages \
 | 
				
			||||||
    -d "api-key=BOT_API_KEY" \
 | 
					    -d "api-key=BOT_API_KEY" \
 | 
				
			||||||
    -d "email=BOT_EMAIL"
 | 
					    -d "email=BOT_EMAIL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,8 +94,8 @@ class Client(object):
 | 
				
			||||||
                site = "https://" + site
 | 
					                site = "https://" + site
 | 
				
			||||||
            self.base_url = site
 | 
					            self.base_url = site
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.base_url = "https://api.humbughq.com"
 | 
					            self.base_url = "https://api.zulip.com"
 | 
				
			||||||
        if self.base_url != "https://api.humbughq.com" and not self.base_url.endswith("/api"):
 | 
					        if self.base_url != "https://api.zulip.com" and not self.base_url.endswith("/api"):
 | 
				
			||||||
            self.base_url += "/api"
 | 
					            self.base_url += "/api"
 | 
				
			||||||
        if not self.base_url.endswith("/"):
 | 
					        if not self.base_url.endswith("/"):
 | 
				
			||||||
            self.base_url += "/"
 | 
					            self.base_url += "/"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,4 +54,4 @@ def commit_notice_destination(repo, branch, commit):
 | 
				
			||||||
HUMBUG_API_PATH = None
 | 
					HUMBUG_API_PATH = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This should not need to change unless you have a custom Humbug subdomain.
 | 
					# This should not need to change unless you have a custom Humbug subdomain.
 | 
				
			||||||
HUMBUG_SITE = "https://api.humbughq.com"
 | 
					HUMBUG_SITE = "https://api.zulip.com"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ class HumbugListener extends AbstractIssueEventListener {
 | 
				
			||||||
    String issueBaseUrl = "https://jira.COMPANY.com/browse/"
 | 
					    String issueBaseUrl = "https://jira.COMPANY.com/browse/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Your humbug domain, only change if you have a custom one
 | 
					    // Your humbug domain, only change if you have a custom one
 | 
				
			||||||
    String domain = ""
 | 
					    String base_url = "https://api.zulip.com"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    void workflowEvent(IssueEvent event) {
 | 
					    void workflowEvent(IssueEvent event) {
 | 
				
			||||||
| 
						 | 
					@ -142,10 +142,6 @@ class HumbugListener extends AbstractIssueEventListener {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    String humbugUrl(method) {
 | 
					    String humbugUrl(method) {
 | 
				
			||||||
      String url = "humbughq.com"
 | 
					      return base_url + "/v1/" + method
 | 
				
			||||||
      if (domain != "") {
 | 
					 | 
				
			||||||
        url = domain + "." + url
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      return "https://" + url + "/api/v1/" + method
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,4 +54,4 @@ def commit_notice_destination(path, commit):
 | 
				
			||||||
HUMBUG_API_PATH = None
 | 
					HUMBUG_API_PATH = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This should not need to change unless you have a custom Humbug subdomain.
 | 
					# This should not need to change unless you have a custom Humbug subdomain.
 | 
				
			||||||
HUMBUG_SITE = "https://api.humbughq.com"
 | 
					HUMBUG_SITE = "https://api.zulip.com"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,4 +49,4 @@ TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment",
 | 
				
			||||||
HUMBUG_API_PATH = None
 | 
					HUMBUG_API_PATH = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This should not need to change unless you have a custom Humbug subdomain.
 | 
					# This should not need to change unless you have a custom Humbug subdomain.
 | 
				
			||||||
HUMBUG_SITE = "https://api.humbughq.com"
 | 
					HUMBUG_SITE = "https://api.zulip.com"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
										
									
									
									
								
							| 
						 | 
					@ -24,7 +24,7 @@ setup(name='humbug',
 | 
				
			||||||
          'License :: OSI Approved :: MIT License',
 | 
					          'License :: OSI Approved :: MIT License',
 | 
				
			||||||
          'Topic :: Communications :: Chat',
 | 
					          'Topic :: Communications :: Chat',
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      url='https://humbughq.com/dist/api/',
 | 
					      url='https://www.zulip.com/dist/api/',
 | 
				
			||||||
      packages=['humbug'],
 | 
					      packages=['humbug'],
 | 
				
			||||||
      data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message", "examples/subscribe",
 | 
					      data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message", "examples/subscribe",
 | 
				
			||||||
                                             "examples/get-public-streams", "examples/unsubscribe",
 | 
					                                             "examples/get-public-streams", "examples/unsubscribe",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue