aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 64f4775..be6ea3f 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -44,6 +44,7 @@ class Mastodon:
44 44
45 Returns client_id and client_secret. 45 Returns client_id and client_secret.
46 """ 46 """
47 api_base_url = Mastodon.__protocolize(api_base_url)
47 48
48 request_data = { 49 request_data = {
49 'client_name': client_name, 50 'client_name': client_name,
@@ -95,7 +96,7 @@ class Mastodon:
95 By default, a timeout of 300 seconds is used for all requests. If you wish to change this, 96 By default, a timeout of 300 seconds is used for all requests. If you wish to change this,
96 pass the desired timeout (in seconds) as request_timeout. 97 pass the desired timeout (in seconds) as request_timeout.
97 """ 98 """
98 self.api_base_url = api_base_url 99 self.api_base_url = Mastodon.__protocolize(api_base_url)
99 self.client_id = client_id 100 self.client_id = client_id
100 self.client_secret = client_secret 101 self.client_secret = client_secret
101 self.access_token = access_token 102 self.access_token = access_token
@@ -976,6 +977,13 @@ class Mastodon:
976 """Internal helper for oauth code""" 977 """Internal helper for oauth code"""
977 self._refresh_token = value 978 self._refresh_token = value
978 return 979 return
980
981 @staticmethod
982 def __protocolize(base_url):
983 """Internal add-protocol-to-url helper"""
984 if not base_url.startswith("http://") and not base_url.startswith("https://"):
985 base_url = "https://" + base_url
986 return base_url
979 987
980## 988##
981# Exceptions 989# Exceptions
Powered by cgit v1.2.3 (git 2.41.0)