Amm1rr / WebAI-to-API

Claude, Gemini to API : ) (Don't need API KEY)
MIT License
229 stars 41 forks source link

How to get Claude Cookie #13

Closed zexry619 closed 1 year ago

zexry619 commented 1 year ago

image

I still don't understand how to get this session key.

The format is still not correct. When I copy all the values it appears like this:

   File "/usr/local/lib/python3.10/dist-packages/browser_cookie3/__init__.py", line 195, in __enter__
     self.__connection = open_dbus_connection()
   File "/usr/lib/python3/dist-packages/jeepney/io/blocking.py", line 332, in open_dbus_connection
     bus_addr = get_bus(bus)
   File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 53, in get_bus
     return find_session_bus()
   File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 42, in find_session_bus
     addr = os.environ['DBUS_SESSION_BUS_ADDRESS']
   File "/usr/lib/python3.10/os.py", line 680, in __getitem__
     raise KeyError(key) from None
KeyError: 'DBUS_SESSION_BUS_ADDRESS'

Can anyone provide an example in a Video or Image with a detailed explanation?

Amm1rr commented 1 year ago

I think I understand what the issue is. Is that screenshot yours?

Because the value in the screenshot is different, perhaps Claude has made changes.

In the 'main.py' file, specifically on line 464, there is an if condition that checks the value like this:

cookie = f"sessionKey={cookie}"

You can simply comment out that line.

Additionally, you can leave the session ID value empty for Claude in the config file.

Please keep me updated on how things are going!

zexry619 commented 1 year ago

I've tried commenting on that line and instead everything gets an error.

That's right, the screenshot is mine.

I hope you update soon, because I don't understand.

Amm1rr commented 1 year ago

When you comment on that line, what is your error? Same?

zexry619 commented 1 year ago

it shows :

  File "/home/zekriansyah/Downloads/WebAI-to-API/src/main.py", line 465
    else:
    ^
IndentationError: expected an indented block after 'if' statement on line 463
Amm1rr commented 1 year ago

You have a syntax error. Instead of commenting out that line, replace it with 'pass':

if cookie:
        #cookie = f"sessionKey={cookie}"
        pass
else:
        ...
        ...
zexry619 commented 1 year ago

keep getting error like this. :

     return self.__get_secretstorage_password(os_crypt_name)
   File "/usr/local/lib/python3.10/dist-packages/browser_cookie3/__init__.py", line 247, in __get_secretstorage_password
     return self.__methods_map.get('secretstorage')(schema, os_crypt_name)
   File "/usr/local/lib/python3.10/dist-packages/browser_cookie3/__init__.py", line 303, in __get_secretstorage_item_jeepney
     with _JeepneyConnection(*args) as connection:
   File "/usr/local/lib/python3.10/dist-packages/browser_cookie3/__init__.py", line 195, in __enter__
     self.__connection = open_dbus_connection()
   File "/usr/lib/python3/dist-packages/jeepney/io/blocking.py", line 332, in open_dbus_connection
     bus_addr = get_bus(bus)
   File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 53, in get_bus
     return find_session_bus()
   File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 42, in find_session_bus
     addr = os.environ['DBUS_SESSION_BUS_ADDRESS']
   File "/usr/lib/python3.10/os.py", line 680, in __getitem__
     raise KeyError(key) from None
KeyError: 'DBUS_SESSION_BUS_ADDRESS'

Do I still need to rename Config.conf.example to Config.conf and fill in the Cookie value?

Amm1rr commented 1 year ago

Yes : )

zexry619 commented 1 year ago

Its Working now thank you! image