From 63975a07ad84b76bfc793a82d3da13ca9180684f Mon Sep 17 00:00:00 2001 From: Tobias Bradtke Date: Sun, 12 May 2019 02:13:57 +0200 Subject: [PATCH] Only set authorization header if access_token is present --- mastodon/Mastodon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 4373acd..9aa5320 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -2849,7 +2849,7 @@ class Mastodon: # Connect function (called and then potentially passed to async handler) def connect_func(): - headers = {"Authorization": "Bearer " + self.access_token} + headers = {"Authorization": "Bearer " + self.access_token} if self.access_token else {} connection = self.session.get(url + endpoint, headers = headers, data = params, stream = True, timeout=(self.request_timeout, timeout))