Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

I keep getting HTTPError: 403 Client Error: Forbidden for url: https://www.textnow.com/api/users/my_username/messages #35

@xoy74

Description

@xoy74

I can't get a simple script to send a test message. I keep getting an error 403
The code looks like this:

from pythontextnow import Client
USERNAME = "myuser.name"
SID_COOKIE = see below
Client.set_client_config(username=USERNAME, sid_cookie=SID_COOKIE)
from pythontextnow import ConversationService
PHONE_NUMBER = "+14165551234"
conversation_service = ConversationService(conversation_phone_numbers=[PHONE_NUMBER])
conversation_service.send_message(message="Hello World!")

The error I get:

Traceback (most recent call last):
File "/home/liviu/textnow/victor/test.py", line 13, in
conversation_service.send_message(message="Hello World!")
File "/usr/local/lib/python3.11/dist-packages/pythontextnow/service/ConversationService.py", line 89, in send_message
self.__text_now_api.send_message(message=message, send_to=self.__conversation_number)
File "/usr/local/lib/python3.11/dist-packages/pythontextnow/decorator/cooldown.py", line 29, in wrapFunction
return function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pythontextnow/api/TextNowAPI.py", line 60, in send_message
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://www.textnow.com/api/users/myuser.name/messages

Clearly I am missing something in the authentication but I have no idea what. The cookie looks like this (I changed a few characters from the real one)
connect.sid=s%3Ah1zL9MFKwr3YU2EhgRexzB8zW7EZnPYI.xeFi4FWhEgBLPWUcfhkOgG7v2wvDyCzYEU3%2FOoJLS5E
Does it mean my
SID_COOKIE = "s%3Ah1zL9MFKwr3YU2EhgRexzB8zW7EZnPYI.xeFi4FWhEgBLPWUcfhkOgG7v2wvDyCzYEU3%2FOoJLS5E" ?
I tried also to replace %3A and %2F so the string becomes
SID_COOKIE = "s:h1zL9MFKwr3YU2EhgRexzB8zW7EZnPYI.xeFi4FWhEgBLPWUcfhkOgG7v2wvDyCzYEU3/OoJLS5E"
but neither one works.
Also, my username has a period, does that character need to be escaped in some way ?
Thanks for any feedback

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions