From bc5dc434c66061508dcefc2a09b6c46f9a01c6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 19 Feb 2024 15:13:08 +0900 Subject: [PATCH 1/2] add guest test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- test/python/test_serialize_guest.py | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/python/test_serialize_guest.py diff --git a/test/python/test_serialize_guest.py b/test/python/test_serialize_guest.py new file mode 100644 index 0000000..1e26d03 --- /dev/null +++ b/test/python/test_serialize_guest.py @@ -0,0 +1,49 @@ +import json +from pathlib import Path + +import openapi_client as pt + + +def get_kwargs(key, additional): + kwargs = {"path_query_id": placeholder[key]["queryId"]} + if placeholder[key].get("variables") is not None: + kwargs["variables"] = json.dumps(placeholder[key]["variables"] | additional) + if placeholder[key].get("features") is not None: + kwargs["features"] = json.dumps(placeholder[key]["features"]) + if placeholder[key].get("fieldToggles") is not None: + kwargs["field_toggles"] = json.dumps(placeholder[key]["fieldToggles"]) + return kwargs + + +if __name__ == "__main__": + if Path("cookie.json").exists(): + with open("cookie.json", "r") as f: + cookies = json.load(f) + cookies_str = "; ".join([f"{k}={v}" for k, v in cookies.items()]) + + with open("src/config/placeholder.json", "r") as f: + placeholder = json.load(f) + + api_conf = pt.Configuration( + api_key={ + "ClientLanguage": "en", + "ActiveUser": "yes", + "GuestToken": cookies["gt"], + }, + ) + api_conf.access_token = "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA" + api_client = pt.ApiClient(configuration=api_conf, cookie=cookies_str) + api_client.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" + + pt.TweetApi(api_client).get_user_tweets_with_http_info( + **get_kwargs("UserTweets", {}), + ) + pt.TweetApi(api_client).get_user_highlights_tweets_with_http_info( + **get_kwargs("UserHighlightsTweets", {}), + ) + pt.DefaultApi(api_client).get_tweet_result_by_rest_id_with_http_info( + **get_kwargs("TweetResultByRestId", {}), + ) + pt.UserApi(api_client).get_user_by_screen_name_with_http_info( + **get_kwargs("UserByScreenName", {}) + ) From adac21f94d9c6302f784aaf81894eb06ac1c3c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 19 Feb 2024 15:13:39 +0900 Subject: [PATCH 2/2] add TopAndBottom and remove timestamp required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 1 + dist/compatible_discriminator/openapi-3.0.yaml | 1 + dist/docs/openapi-3.0.yaml | 1 + src/openapi/schemas/instruction.yaml | 2 +- src/openapi/schemas/tweet.yaml | 1 - 5 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 6383149..f19868e 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -1660,6 +1660,7 @@ components: enum: - Top - Bottom + - TopAndBottom type: string type: $ref: '#/components/schemas/InstructionType' diff --git a/dist/compatible_discriminator/openapi-3.0.yaml b/dist/compatible_discriminator/openapi-3.0.yaml index 9a4a884..fd12dea 100644 --- a/dist/compatible_discriminator/openapi-3.0.yaml +++ b/dist/compatible_discriminator/openapi-3.0.yaml @@ -1660,6 +1660,7 @@ components: enum: - Top - Bottom + - TopAndBottom type: string type: $ref: '#/components/schemas/InstructionType' diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index e03eeaa..532c39a 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -1660,6 +1660,7 @@ components: enum: - Top - Bottom + - TopAndBottom type: string type: $ref: '#/components/schemas/InstructionType' diff --git a/src/openapi/schemas/instruction.yaml b/src/openapi/schemas/instruction.yaml index 1a897da..f89b603 100644 --- a/src/openapi/schemas/instruction.yaml +++ b/src/openapi/schemas/instruction.yaml @@ -150,7 +150,7 @@ components: $ref: "#/components/schemas/InstructionType" # TimelineTerminateTimeline direction: type: string - enum: [Top, Bottom] + enum: [Top, Bottom, TopAndBottom] TimelineAddEntry: required: diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index ab03dcb..f87deab 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -927,7 +927,6 @@ components: - "symbols" - "user_mentions" - "urls" - - "timestamps" properties: hashtags: type: array