Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manufactureitem endpoint #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tgtg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ABORT_ORDER_ENDPOINT = "order/v7/{}/abort"
ORDER_STATUS_ENDPOINT = "order/v7/{}/status"
API_BUCKET_ENDPOINT = "discover/v1/bucket"
MANUFACTURERITEM_ENDPOINT = "manufactureritem/v2/"
DEFAULT_APK_VERSION = "22.5.5"
USER_AGENTS = [
"TGTG/{} Dalvik/2.1.0 (Linux; U; Android 9; Nexus 5 Build/M4B30Z)",
Expand Down Expand Up @@ -439,3 +440,32 @@ def get_inactive(self, page=0, page_size=20):
return response.json()
else:
raise TgtgAPIError(response.status_code, response.content)

def get_manufactureitem(self):
self.login()
response = self.session.post(
self._get_url(MANUFACTURERITEM_ENDPOINT),
headers=self._headers,
json={
"action_types_accepted": ["QUERY"],
"display_types_accepted": ["LIST", "FILL"],
"element_types_accepted": [
"ITEM",
"HIGHLIGHTED_ITEM",
"MANUFACTURER_STORY_CARD",
"DUO_ITEMS",
"DUO_ITEMS_V2",
"TEXT",
"PARCEL_TEXT",
"NPS",
"SMALL_CARDS_CAROUSEL",
"ITEM_CARDS_CAROUSEL",
],
},
proxies=self.proxies,
timeout=self.timeout,
)
if response.status_code == HTTPStatus.OK:
return response.json()
else:
raise TgtgAPIError(response.status_code, response.content)
Loading