aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-11-24 15:26:42 +0100
committerLorenz Diener <[email protected]>2017-11-24 15:26:42 +0100
commit18f69451edaed597909de34ffccac1073b6c9e6b (patch)
treef4beb4da6c66fa61d294787f8a7505cba8a6ccdd /mastodon
parent9e97fce2d6f350c45603f200d5cda0962b63cb86 (diff)
parent92adc94a774e1650dba9ba72175d59c4f44a21c5 (diff)
downloadmastodon.py-18f69451edaed597909de34ffccac1073b6c9e6b.tar.gz
Merge branch 'master' of https://github.com/halcy/Mastodon.py
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)