aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index fff365f..e3aac69 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -20,7 +20,6 @@ class Mastodon:
20 patch in Real Proper OAuth if desired. 20 patch in Real Proper OAuth if desired.
21 """ 21 """
22 __DEFAULT_BASE_URL = 'https://mastodon.social' 22 __DEFAULT_BASE_URL = 'https://mastodon.social'
23 __DEBUG_REQUESTS = False
24 23
25 ### 24 ###
26 # Registering apps 25 # Registering apps
@@ -58,7 +57,7 @@ class Mastodon:
58 ### 57 ###
59 # Authentication, including constructor 58 # Authentication, including constructor
60 ### 59 ###
61 def __init__(self, client_id, client_secret = None, access_token = None, api_base_url = __DEFAULT_BASE_URL): 60 def __init__(self, client_id, client_secret = None, access_token = None, api_base_url = __DEFAULT_BASE_URL, debug_requests = False):
62 """ 61 """
63 Creates a new API wrapper instance based on the given client_secret and client_id. If you 62 Creates a new API wrapper instance based on the given client_secret and client_id. If you
64 give a client_id and it is not a file, you must also give a secret. 63 give a client_id and it is not a file, you must also give a secret.
@@ -72,6 +71,7 @@ class Mastodon:
72 self.client_id = client_id 71 self.client_id = client_id
73 self.client_secret = client_secret 72 self.client_secret = client_secret
74 self.access_token = access_token 73 self.access_token = access_token
74 self.debug_requests = debug_requests
75 75
76 if os.path.isfile(self.client_id): 76 if os.path.isfile(self.client_id):
77 with open(self.client_id, 'r') as secret_file: 77 with open(self.client_id, 'r') as secret_file:
@@ -345,7 +345,7 @@ class Mastodon:
345 if self.access_token != None: 345 if self.access_token != None:
346 headers = {'Authorization': 'Bearer ' + self.access_token} 346 headers = {'Authorization': 'Bearer ' + self.access_token}
347 347
348 if __DEBUG_REQUESTS = True: 348 if self.debug_requests == True:
349 print('Mastodon: Request to endpoint "' + endpoint + '" using method "' + method + '".') 349 print('Mastodon: Request to endpoint "' + endpoint + '" using method "' + method + '".')
350 print('Parameters: ' + str(params)) 350 print('Parameters: ' + str(params))
351 print('Headers: ' + str(headers)) 351 print('Headers: ' + str(headers))
Powered by cgit v1.2.3 (git 2.41.0)