Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
feat: add gemini api parse method
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed Mar 20, 2024
1 parent 1abaf33 commit bf1d558
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bardapi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import string
import uuid
import requests
import gemini
from typing import Optional
from gemini.src.model.parser.response_parser import ResponseParser

# from urllib.parse import parse_qs, urlparse
try:
Expand Down Expand Up @@ -281,6 +283,13 @@ def get_answer(
proxies=self.proxies,
)

try:
parser = ResponseParser(cookies=self.cookies)
return parser.parse(resp)
except:
pass


# Post-processing of response
resp_dict = json.loads(resp.content.splitlines()[-5])[0][2]

Expand Down

0 comments on commit bf1d558

Please sign in to comment.