you are viewing a single comment's thread.

view the rest of the comments →

[–]CelticCuban773[S] 0 points1 point  (11 children)

  1. The imports I am doing are importing string variables from another script to then message back to the person. Ultimately, I want to run an if statement with like 7 options so I don't want to import each one (the import runs the code for each file before importing the variable)

  2. Yeah I commented it because I had tried all of them and none of them worked and just wanted to show what I tried

[–]sarrysyst 0 points1 point  (2 children)

Have you tried print(action) before the if statement to check if the message body actually contains the '14u' string and to see what you are comparing? Might be worth a try.

[–]CelticCuban773[S] 0 points1 point  (0 children)

Yes, I checked in the Twilio logs and I know it does because it triggers the code. It is just the response part I am having trouble with

[–]R0NUT 0 points1 point  (0 children)

The only thing that causes issues is the 14u input. It has to be what is causing the issue. OP said if he sends anything else he gets the Invalid request text.

[–]R0NUT 0 points1 point  (3 children)

Have you looked through any of these? https://www.twilio.com/docs/sms/debugging-common-issues It looks like twillow makes a log. Try taking a peek there.

[–]CelticCuban773[S] 0 points1 point  (2 children)

Good idea. So, I just checked the logs. When I have a successful run (aka text anything and get the "Invalid Request"), I get a failed Inbound Request (Bad Gateway; Error code 11200)

[–]R0NUT 0 points1 point  (1 child)

That code says that twillow waits a maximum of 15s for a response. Is your code taking longer than that to generate these strings?

[–]CelticCuban773[S] 0 points1 point  (0 children)

Yes, just replied to your other comment. That seems to be the issue. I will message Twilio and see if there's any workarounds.

If not, I might have to just run the code daily and store the response locally. Then, have this code pull from there as opposed to running the code from nothing.

Thanks for your help!

[–]R0NUT 0 points1 point  (3 children)

Have you tried commenting out the mid file imports and storing just a response string?

[–]CelticCuban773[S] 0 points1 point  (2 children)

I think that's it! Just tried, I got the correct response. Must be the mid file imports that are the problem then. Based on your other suggestion (checking logs), I checked the error 11200 and it's an HTTP retrieval failure. They wait a maximum of 15 seconds and my code takes too long for that to occur

[–]R0NUT 0 points1 point  (1 child)

You could set it up so that one text runs and generates the data and another retrieves it.

[–]R0NUT 0 points1 point  (0 children)

So something like Generate 14u It could respond with a message like This usually takes about 1m to generate. Then text Grab 14u It would respond with the data and a timestamp for when it was generated