From 60ddaf97ef93d839fff56153d6efd48459d9648f Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 13 Sep 2025 10:31:46 +0000 Subject: [PATCH 1/3] Delivery --- README.md | 1 + tgtg/__init__.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 639cbf9..0ea3bca 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Handle: - get the status of an order (`/api/order/vX/:id/status`) - get active orders (`/api/order/vX/active`) - get inactive orders (`/api/order/vX/inactive`) +- get delivery items (`api/manufactureritem/v2`) ## Install diff --git a/tgtg/__init__.py b/tgtg/__init__.py index d768eb7..61dc2db 100644 --- a/tgtg/__init__.py +++ b/tgtg/__init__.py @@ -25,6 +25,8 @@ ABORT_ORDER_ENDPOINT = "order/v8/{}/abort" ORDER_STATUS_ENDPOINT = "order/v8/{}/status" API_BUCKET_ENDPOINT = "discover/v1/bucket" +MANUFACTURER_ITEM_ENDPOINT = "manufactureritem/v2/" + DEFAULT_APK_VERSION = "24.11.0" USER_AGENTS = [ "TGTG/{} Dalvik/2.1.0 (Linux; U; Android 9; Nexus 5 Build/M4B30Z)", @@ -430,3 +432,25 @@ def get_inactive(self, page=0, page_size=20): return response.json() else: raise TgtgAPIError(response.status_code, response.content) + + def get_manufacturer_items( + self + ): + self.login() + + data = { + "display_types_accepted": [ "LIST" ], + "element_types_accepted": [ "ITEM", "NPS", "TEXT", "DUO_ITEMS", "MANUFACTURER_STORY_CARD"], + "action_types_accepted": [] + } + response = self.session.post( + self._get_url(MANUFACTURER_ITEM_ENDPOINT), + headers=self._headers, + json=data, + proxies=self.proxies, + timeout=self.timeout, + ) + if response.status_code == HTTPStatus.OK: + return response.json() + else: + raise TgtgAPIError(response.status_code, response.content) \ No newline at end of file From 39f195b02ece36fbe6464bec7749726c456d5864 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 13 Sep 2025 10:34:11 +0000 Subject: [PATCH 2/3] fix --- tgtg/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgtg/__init__.py b/tgtg/__init__.py index 61dc2db..a914f2a 100644 --- a/tgtg/__init__.py +++ b/tgtg/__init__.py @@ -25,7 +25,7 @@ ABORT_ORDER_ENDPOINT = "order/v8/{}/abort" ORDER_STATUS_ENDPOINT = "order/v8/{}/status" API_BUCKET_ENDPOINT = "discover/v1/bucket" -MANUFACTURER_ITEM_ENDPOINT = "manufactureritem/v2/" +MANUFACTURER_ITEM_ENDPOINT = "manufactureritem/v2" DEFAULT_APK_VERSION = "24.11.0" USER_AGENTS = [ From 44ee175366bb58dbd7ab99b6fd9d5b10f4ace091 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Sep 2025 11:06:40 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tgtg/__init__.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tgtg/__init__.py b/tgtg/__init__.py index a914f2a..b804e0b 100644 --- a/tgtg/__init__.py +++ b/tgtg/__init__.py @@ -433,15 +433,19 @@ def get_inactive(self, page=0, page_size=20): else: raise TgtgAPIError(response.status_code, response.content) - def get_manufacturer_items( - self - ): + def get_manufacturer_items(self): self.login() data = { - "display_types_accepted": [ "LIST" ], - "element_types_accepted": [ "ITEM", "NPS", "TEXT", "DUO_ITEMS", "MANUFACTURER_STORY_CARD"], - "action_types_accepted": [] + "display_types_accepted": ["LIST"], + "element_types_accepted": [ + "ITEM", + "NPS", + "TEXT", + "DUO_ITEMS", + "MANUFACTURER_STORY_CARD", + ], + "action_types_accepted": [], } response = self.session.post( self._get_url(MANUFACTURER_ITEM_ENDPOINT), @@ -453,4 +457,4 @@ def get_manufacturer_items( if response.status_code == HTTPStatus.OK: return response.json() else: - raise TgtgAPIError(response.status_code, response.content) \ No newline at end of file + raise TgtgAPIError(response.status_code, response.content)