Claude-API icon indicating copy to clipboard operation
Claude-API copied to clipboard

claude_api.send_message() error

Open GhalebAldoboni opened this issue 2 years ago • 5 comments

response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

GhalebAldoboni avatar Sep 24 '23 20:09 GhalebAldoboni

I tried to use US VPN and changed the cookie but got the same error

GhalebAldoboni avatar Sep 24 '23 20:09 GhalebAldoboni

It works for me though, can you give more detailed info?

Randomboiii03 avatar Sep 25 '23 12:09 Randomboiii03

image

That's the error that I get, I tried the API on google colab and got the same thing as well :

response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

GhalebAldoboni avatar Sep 25 '23 15:09 GhalebAldoboni

image

That's the error that I get, I tried the API on google colab and got the same thing as well :

response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

remove the "<conversation_id>" or , if this answers your problem can you closed this issue thanks 🎉

Randomboiii03 avatar Sep 26 '23 10:09 Randomboiii03

Possible causes: 1, this is because the proxy region is not allowed to provide services 2, the transmission of an incorrect parameter, such as "model" in "headers" should be updated to the same version as the web page.

caicaicaibeiqie avatar Feb 01 '24 02:02 caicaicaibeiqie