kopia lustrzana https://github.com/halcy/Mastodon.py
Fix version crash when connecting to gotosocial
While gotosocial has a PR open to send a Mastodon-compatible version in the `instance` endpoint, whatever it sends is unlikely to be helpful for the purpose of version-gating features in the client library. You can disable version-gating, but it still fails on instantiating due to GtS's version not matching the semver regex. Fix this by moving the version_check_mode above it, and not parsing the version if it's turned off.pull/248/head
rodzic
b69e998ceb
commit
144a4e2b9b
|
@ -421,20 +421,20 @@ class Mastodon:
|
|||
if not (self.api_base_url is None or try_base_url == self.api_base_url):
|
||||
raise MastodonIllegalArgumentError('Mismatch in base URLs between files and/or specified')
|
||||
self.api_base_url = try_base_url
|
||||
|
||||
if not version_check_mode in ["created", "changed", "none"]:
|
||||
raise MastodonIllegalArgumentError("Invalid version check method.")
|
||||
self.version_check_mode = version_check_mode
|
||||
|
||||
# Versioning
|
||||
if mastodon_version == None:
|
||||
if mastodon_version == None and self.version_check_mode != 'none':
|
||||
self.retrieve_mastodon_version()
|
||||
else:
|
||||
elif self.version_check_mode != 'none':
|
||||
try:
|
||||
self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(mastodon_version)
|
||||
except:
|
||||
raise MastodonVersionError("Bad version specified")
|
||||
|
||||
if not version_check_mode in ["created", "changed", "none"]:
|
||||
raise MastodonIllegalArgumentError("Invalid version check method.")
|
||||
self.version_check_mode = version_check_mode
|
||||
|
||||
# Ratelimiting parameter check
|
||||
if ratelimit_method not in ["throw", "wait", "pace"]:
|
||||
raise MastodonIllegalArgumentError("Invalid ratelimit method.")
|
||||
|
|
Ładowanie…
Reference in New Issue