pull/279/head
halcy 2022-11-25 00:09:54 +02:00
rodzic cbfb3977eb
commit 89678e0565
2 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -3647,11 +3647,8 @@ class Mastodon:
else: else:
json_object[k] = dateutil.parser.parse(v) json_object[k] = dateutil.parser.parse(v)
except: except:
if isinstance(v, str) and len(v.strip()) == 0: # When we can't parse a date, we just leave the field out
# Pleroma bug workaround: Empty string becomes start of epoch del json_object[k]
json_object[k] = datetime.datetime.fromtimestamp(0)
else:
raise MastodonAPIError('Encountered invalid date.')
return json_object return json_object
@staticmethod @staticmethod

Wyświetl plik

@ -9,7 +9,9 @@ def test_constructor_from_filenames(tmpdir):
access.write_text(u'baz\n', 'UTF-8') access.write_text(u'baz\n', 'UTF-8')
api = Mastodon( api = Mastodon(
str(client), str(client),
access_token=str(access)) access_token=str(access),
api_base_url="mastodon.social"
)
assert api.client_id == 'foo' assert api.client_id == 'foo'
assert api.client_secret == 'bar' assert api.client_secret == 'bar'
assert api.access_token == 'baz' assert api.access_token == 'baz'