aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 011d731..88f4906 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1279,9 +1279,16 @@ class Mastodon:
1279 instance = self.instance() 1279 instance = self.instance()
1280 if "streaming_api" in instance["urls"] and instance["urls"]["streaming_api"] != self.api_base_url: 1280 if "streaming_api" in instance["urls"] and instance["urls"]["streaming_api"] != self.api_base_url:
1281 # This is probably a websockets URL, which is really for the browser, but requests can't handle it 1281 # This is probably a websockets URL, which is really for the browser, but requests can't handle it
1282 # So we do this below to turn it into an HTTPS URL 1282 # So we do this below to turn it into an HTTPS or HTTP URL
1283 parse = urlparse(instance["urls"]["streaming_api"]) 1283 parse = urlparse(instance["urls"]["streaming_api"])
1284 url = "https://" + parse.netloc 1284 if parse.scheme == 'wss':
1285 url = "https://" + parse.netloc
1286 elif parse.scheme == 'ws':
1287 url = "http://" + parse.netloc
1288 else:
1289 raise MastodonAPIError(
1290 "Could not parse streaming api location returned from server: {}.".format(
1291 instance["urls"]["streaming_api"]))
1285 else: 1292 else:
1286 url = self.api_base_url 1293 url = self.api_base_url
1287 1294
Powered by cgit v1.2.3 (git 2.41.0)