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

Wyświetl plik

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