From: Simon Tatham Date: Fri, 22 Dec 2023 10:18:55 +0000 (+0000) Subject: Fix the various 'user's posts' variations. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c197eab2add5df20f81eae817fd78007e4af0837;p=mastodonochrome.git Fix the various 'user's posts' variations. By generalising the True/False -> true/false mapping across all booleans submitted as request parameters. --- diff --git a/client.py b/client.py index b1bd560..ea1619a 100644 --- a/client.py +++ b/client.py @@ -76,6 +76,11 @@ class Client: self.readonly = True def method_start(self, method, path, base, params, stream, links={}): + def transform(value): + if isinstance(value, bool): + return {False:"false", True:"true"}[value] + return value + params = {key: transform(value) for key, value in params.items()} headers = {} if self.bearer_token is not None: headers['Authorization'] = 'Bearer ' + self.bearer_token @@ -254,7 +259,7 @@ class HomeTimelineFeed(IncrementalServerFeed): class PublicTimelineFeed(IncrementalServerFeed): def __init__(self, client, local): super().__init__(client, "timelines/public", { - 'local': {False:"false", True:"true"}[local] + 'local': local }) class MentionsFeed(IncrementalServerFeed):