Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting JSONDecodeError on invalid response from API #49

Closed
MominIqbal-1234 opened this issue Mar 10, 2024 · 5 comments · Fixed by #50
Closed

Getting JSONDecodeError on invalid response from API #49

MominIqbal-1234 opened this issue Mar 10, 2024 · 5 comments · Fixed by #50
Assignees
Labels
bug Something isn't working

Comments

@MominIqbal-1234
Copy link

Traceback (most recent call last):
File "/workspaces/whatsapp-api-client-python/main.py", line 15, in
main()
File "/workspaces/whatsapp-api-client-python/main.py", line 9, in main
response = greenAPI.sending.sendMessage("11001234567@c.us", "Message text")
File "/workspaces/whatsapp-api-client-python/whatsapp_api_client_python/tools/sending.py", line 32, in sendMessage
return self.api.request(
File "/workspaces/whatsapp-api-client-python/whatsapp_api_client_python/API.py", line 93, in request
self.__handle_response(response)
File "/workspaces/whatsapp-api-client-python/whatsapp_api_client_python/API.py", line 117, in __handle_response
json.loads(response.text), ensure_ascii=False, indent=4
File "/home/codespace/.python/current/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/home/codespace/.python/current/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/codespace/.python/current/lib/python3.10/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)

@lent0s
Copy link

lent0s commented Mar 11, 2024

Good afternoon!
For prompt answers regarding working with the service, we recommend contacting technical support:


In a line of code:
response = greenAPI.sending.sendMessage("11001234567@c.us", "Message text")
You must correctly specify the phone number as the first argument, not the instance number. You can find out more here:

@Amele9 Amele9 self-assigned this Mar 11, 2024
@Amele9 Amele9 added the bug Something isn't working label Mar 11, 2024
Amele9 added a commit that referenced this issue Mar 11, 2024
@Amele9 Amele9 mentioned this issue Mar 11, 2024
@Amele9 Amele9 changed the title Not Working Getting JSONDecodeError on invalid response from API Mar 11, 2024
Amele9 added a commit that referenced this issue Mar 11, 2024
@Amele9
Copy link
Contributor

Amele9 commented Mar 11, 2024

@MominIqbal-1234 Thanks for submitting the issue. The bug has been fixed in version 0.0.45. You can install the new version with command pip install whatsapp-api-client-python -U.

@MominIqbal-1234
Copy link
Author

2024-03-12 22:15:04:whatsapp-api-client-python:ERROR:Request was failed with status code: 401. Data:
None

@kocherovv
Copy link

Which method returns a 401 error? Please describe the problem in more detail in the technical support channel:

@SergeyShark
Copy link

SergeyShark commented Mar 13, 2024

Status 401 indicates that you have a problem with your instance or token. You probably did not change the initial instance and token. You can get your data in your Green API account, API url and Media url fields for sending media files.
Read more about the error in the article on our website: https://green-api.com/en/docs/api/common-errors/
We also clarify that this is a response from the API and not a library error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants