api: Fix our handling of the --site option.
Tested that the following all do the same thing after this patch: --site=https://ls-dev.zulip.net --site=https://ls-dev.zulip.net/ --site=https://ls-dev.zulip.net/api --site=https://ls-dev.zulip.net/api/ (imported from commit 785c005e4b4be3621d7d330a0173023ab2c77a4d)
This commit is contained in:
		
							parent
							
								
									8f75d55795
								
							
						
					
					
						commit
						30416c860b
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -100,13 +100,15 @@ class Client(object): | |||
|         if site is not None: | ||||
|             if not site.startswith("http"): | ||||
|                 site = "https://" + site | ||||
|             # Remove trailing "/"s from site to simplify the below logic for adding "/api" | ||||
|             site = site.rstrip("/") | ||||
|             self.base_url = site | ||||
|         else: | ||||
|             self.base_url = "https://api.zulip.com" | ||||
| 
 | ||||
|         if self.base_url != "https://api.zulip.com" and not self.base_url.endswith("/api"): | ||||
|             self.base_url += "/api" | ||||
|         if not self.base_url.endswith("/"): | ||||
|             self.base_url += "/" | ||||
|         self.base_url += "/" | ||||
|         self.retry_on_errors = retry_on_errors | ||||
|         self.client_name = client | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tim Abbott
						Tim Abbott