randydev commited on
Commit
f0280ed
·
1 Parent(s): c97e3fc

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +18 -1
main.py CHANGED
@@ -582,8 +582,25 @@ def gemini_pro(
582
  token = bard_api_key
583
  else:
584
  token = COOKIE_BARD_TOKEN
 
 
 
 
 
 
585
  try:
586
- bard = Bard(token=token)
 
 
 
 
 
 
 
 
 
 
 
587
  message = bard.get_answer(query)["content"]
588
  return {
589
  "status": "true",
 
582
  token = bard_api_key
583
  else:
584
  token = COOKIE_BARD_TOKEN
585
+ owner_base = f"""
586
+ Your name is Randy Dev. A kind and friendly AI assistant that answers in
587
+ a short and concise answer. Give short step-by-step reasoning if required.
588
+
589
+ Today is {dt.now():%A %d %B %Y %H:%M}
590
+ """
591
  try:
592
+ session = requests.Session()
593
+ session.headers = {
594
+ "Host": "bard.google.com",
595
+ "X-Same-Domain": "1",
596
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
597
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
598
+ "Origin": "https://bard.google.com",
599
+ "Referer": "https://bard.google.com/"
600
+ }
601
+ session.cookies.set("__Secure-1PSID", token)
602
+ bard = Bard(token=token, session=session, timeout=30)
603
+ bard.get_answer(owner_base)["content"]
604
  message = bard.get_answer(query)["content"]
605
  return {
606
  "status": "true",