Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
fix authentication (#46)
Browse files Browse the repository at this point in the history
Added new cookie authentication parameter: SRCHHPGUSR
  • Loading branch information
doevent committed Aug 10, 2023
1 parent cbd9357 commit e7b748d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/BingImageCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ImageGen:
Image generation by Microsoft Bing
Parameters:
auth_cookie: str
auth_cookie_SRCHHPGUSR: str
Optional Parameters:
debug_file: str
quiet: bool
Expand All @@ -70,13 +71,15 @@ class ImageGen:
def __init__(
self,
auth_cookie: str,
auth_cookie_SRCHHPGUSR: str,
debug_file: Union[str, None] = None,
quiet: bool = False,
all_cookies: List[Dict] = None,
) -> None:
self.session: requests.Session = requests.Session()
self.session.headers = HEADERS
self.session.cookies.set("_U", auth_cookie)
self.session.cookies.set("SRCHHPGUSR", auth_cookie_SRCHHPGUSR)
if all_cookies:
for cookie in all_cookies:
self.session.cookies.set(cookie["name"], cookie["value"])
Expand Down

0 comments on commit e7b748d

Please sign in to comment.