Closed GorboducRex closed 3 years ago
oh the import namespace is TNAPI but the PyPi name is pytextnow
the command is
pip3 install pytextnow
ModuleNotFoundError: No module named 'pytextnow'
Sorry the namespace is sort of confusing.
You install with pip3 install pytextnow
but you use
import TNAPI
$ pip3 install pytextnow
Collecting pytextnow
Downloading PyTextNow-0.9.6-py3-none-any.whl (7.1 kB)
Requirement already satisfied: requests>2 in /usr/lib/python3/dist-packages (from pytextnow) (2.22.0)
Installing collected packages: pytextnow
Successfully installed pytextnow-0.9.6
In my code:
import TNAPI
Result:
FileNotFoundError: [Errno 2] No such file or directory: '\\user_sids.json'
Sorry to be such a pain.
Its alright. Someone else had this issue and I thought I had patched it. Are you on linux
Ok It should be patched in the latest version
I am. Ubuntu 20.04.2, if it matters. As I mentioned, "\" means nothing to Linux. If you want something in the user's home directory, you'd use "~/" as in "~/user_sids.json" - that would put the file in the user's home directory.
Closer! Now you've got a misspelling:
user_SID_filepath = "\\".join(abspath(__file__).replacce("/", "\\").split("\\")[:-1]) + "\\user_sids.json"
AttributeError: 'str' object has no attribute 'replacce'
HaHa rush job.
Sorry; now we're back to
FileNotFoundError: [Errno 2] No such file or directory: '\\user_sids.json'
But I really appreciate your hard work on this!
Yeah I know I just made a much larger patch to the project.
Ok finally it should be fully functional lmao
And we're back to:
AttributeError: 'str' object has no attribute 'replacce'
Hey, if it was easy, anybody could do it!
hahaha thank you
I just did a test of the current version of pytextnow and it is fully functional Try uninstalling and reinstalling
Go to https://www.textnow.com/messaging and open developer tools Open application tab and copy connect.sid cookie and paste it here.
I didn't realize I'd have to sign up as a developer with them myself. That's a limitation I didn't understand. I don't particularly want to do that. I guess I'll do that later. Thanks for all you hard work and attention.
On Mon, Mar 22, 2021 at 2:15 PM GorboducRex @.***> wrote:
Go to https://www.textnow.com/messaging and open developer tools Open application tab and copy connect.sid cookie and paste it here.
I didn't realize I'd have to sign up as a developer with them myself. That's a limitation I didn't understand. I don't particularly want to do that. I guess I'll do that later. Thanks for all you hard work and attention.
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/leogomezz4t/PyTextNow_API/issues/11#issuecomment-804363544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQV6RXS62PWCEX44QJB327DTE6QMRANCNFSM4ZTVJQ5Q .
No you don’t have to. Developer tools is a feature on google that you can use to see cookies from that website.
Got it! Didn't understand which developer tools you were talking about. Thanks.
And it works!!! Again, thanks for sticking with this. Very nice module!
Aaaaaand... I'm back...
When I use client.get_new_messages(), I get all the messages. When I use client.get_messages() I get only the unread ones. Also, in your examples, some of them don't work. For example, message.number works as message['id'].
Nope... skip the part about all vs. unread. I think that's working fine.
Actually, it seems that no messages come back as unread. All messages works, but new messages does not, even when read is False.
ok so new messages doesn't use read I can't modify the textnow storage so it starts detecting new messages since the initialization of the Client instance
Okay. So if I just use all messages, and go through them myself to find unread, I'll be good. Excellent. Now I just have to figure out how to mark them as read programmatically. Thanks!
Try this for a simple bot
import TNAPI as tn
client = tn.Client("email", "password")
while 1:
msgs = client.get_new_messages()
for msg in msgs:
if msg.type == tn.MESSAGE_TYPE:
if msg.content == "ping":
client.send_sms(msg.number, "pong")
No, the client already finds new messages programmatically
Okay. So if I just use all messages, and go through them myself to find unread, I'll be good. Excellent. Now I just have to figure out how to mark them as read programmatically. Thanks!
the read attribute from get_all_messages is the raw json from the textnow database. Read means if you read the message in the textnow app or website
client.get_new_messages() isn't working for me - it returns nothing. But like I said, client.get_messages() returns everything, so I can deal with it programmatically.
On Mon, Mar 22, 2021 at 3:19 PM GorboducRex @.***> wrote:
client.get_new_messages() isn't working for me - it returns nothing. But like I said, client.get_messages() returns everything, so I can deal with it programmatically.
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/leogomezz4t/PyTextNow_API/issues/11#issuecomment-804402701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQV6RXV3STMX3NAOJCSWMVDTE6X7VANCNFSM4ZTVJQ5Q .
It depends on what you want to do get_new_messages() is works as a way to check if any new messages have been sent since the initialisation of client
Installed the latest TNAPI:
Successfully installed TNAPI-1.0.0 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-20.3.0 multidict-5.1.0 yarl-1.6.3
Went to run code that included this line:import TNAPI
Got:ModuleNotFoundError: No module named 'TNAPI'
Tried lowercase:ModuleNotFoundError: No module named 'tnapi'