Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ading2210 committed Jun 29, 2023
1 parent 6954a1b commit 98bc47c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions poe-api/src/poe.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def get_next_data(self, overwrite_vars=False):

if overwrite_vars:
self.formkey = self.extract_formkey(r.text)
if "payload" in next_data["props"]["pageProps"].keys():
if "payload" in next_data["props"]["pageProps"]:
self.viewer = next_data["props"]["pageProps"]["payload"]["viewer"]
else:
self.viewer = next_data["props"]["pageProps"]["data"]["viewer"]
Expand All @@ -207,11 +207,11 @@ def get_next_data(self, overwrite_vars=False):
def get_bot(self, display_name):
url = f'https://poe.com/_next/data/{self.next_data["buildId"]}/{display_name}.json'

r = request_with_retries(self.session.get, url).json()
if "payload" in r["pageProps"]:
chat_data = r["pageProps"]["payload"]["chatOfBotDisplayName"]
data = request_with_retries(self.session.get, url).json()
if "payload" in data["pageProps"]:
chat_data = data["pageProps"]["payload"]["chatOfBotDisplayName"]
else:
chat_data = r["pageProps"]["data"]["chatOfBotDisplayName"]
chat_data = data["pageProps"]["data"]["chatOfBotDisplayName"]
return chat_data

def get_bots(self, download_next_data=True):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name="poe-api",
version="0.4.6",
version="0.4.7",
author="ading2210",
license="GPLv3",
description="A reverse engineered API wrapper for Quora's Poe",
Expand Down

0 comments on commit 98bc47c

Please sign in to comment.