Hi guys, first of all: Thanks for your great project...
I am using your driver located here: Drivers/SIM800L.py
I don't know where can be a problem and i am writing here entire my scenario and specific information which i know:
I am using latest version:
modem.get_info()
> 'SIM800 R14.18'
and my device is connected on Internet:
modem.get_ip_addr()
>> '100.67.x.x'
# or
url = 'http://checkip.dyn.com/'
response = modem.http_request(url, 'GET')
print('Response status code:', response.status_code)
>> Response status code: 200
All these my experiments are okay.
And here is my problem:
My webserver is based on Flask (with NGINX server) and i have simple and basic endpoint:
@blueprint.route('/api/', methods=['GET'])
def index():
request_status = {'status': 'OK'}
return jsonify(request_status), 200
When i try simple request to my API with requests library ("normal" Python 3.5+):
import requests
r = requests.get('https://ha.datain.app/api/')
print(r.status_code, '/ ', r.content)
>> 200 / b'{"status":"OK"}\n'
And everything looks good...
But when i try similar request to API over my TTGO T-Call SIM800 with code:
print('\nNow running demo http GET...')
url = 'https://ha.datain.app/api/'
response = modem.http_request(url, 'GET')
print('Response status code:', response.status_code)
print('Response content:', response.content)
i see response:
Response status code: 606
Response content:
A am pasting here all info from your additional log:
=== url = 'https://ha.datain.app/api/'
=== response = modem.http_request(url, 'GET')
=== print('Response status code:', response.status_code)
=== print('Response content:', response.content)
Now running demo http GET...
DEBUG: Writing AT command "b'AT+SAPBR=2,1\r\n'"
DEBUG: Read "b'AT+SAPBR=2,1\r\r\n'"
DEBUG: Read "b'+SAPBR: 1,1,"100.67.239.103"\r\n'"
DEBUG: Read "b'\r\n'"
DEBUG: Detected pre-end
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b'+SAPBR: 1,1,"100.67.239.103"'"
DEBUG: Close the http context if left open somehow...
DEBUG: Writing AT command "b'AT+HTTPTERM\r\n'"
DEBUG: Read "b'AT+HTTPTERM\r\r\n'"
DEBUG: Read "b'ERROR\r\n'"
DEBUG: Http request step #1.1 (inithttp)
DEBUG: Writing AT command "b'AT+HTTPINIT\r\n'"
DEBUG: Read "b'AT+HTTPINIT\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
DEBUG: Http request step #1.2 (sethttp)
DEBUG: Writing AT command "b'AT+HTTPPARA="CID",1\r\n'"
DEBUG: Read "b'AT+HTTPPARA="CID",1\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
DEBUG: Http request step #1.3 (enablessl)
DEBUG: Writing AT command "b'AT+HTTPSSL=1\r\n'"
DEBUG: Read "b'AT+HTTPSSL=1\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
DEBUG: Http request step #2.1 (initurl)
DEBUG: Writing AT command "b'AT+HTTPPARA="URL","https://ha.datain.app/api/"\r\n'"
DEBUG: Read "b'AT+HTTPPARA="URL","https://ha.datain.app/api/"\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
DEBUG: Http request step #2.2 (doget)
DEBUG: Writing AT command "b'AT+HTTPACTION=0\r\n'"
DEBUG: Read "b'AT+HTTPACTION=0\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Read "b'\r\n'"
DEBUG: Detected pre-end
DEBUG: Read "b'+HTTPACTION: 0,606,0\r\n'"
DEBUG: Detected startwith end (and adding this line to theoutput too)
DEBUG: Returning "b'OK+HTTPACTION: 0,606,0'"
DEBUG: Response status code: "606"
DEBUG: Http request step #4 (getdata)
DEBUG: Writing AT command "b'AT+HTTPREAD\r\n'"
DEBUG: Read "b'AT+HTTPREAD\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
DEBUG:
DEBUG: Http request step #4 (closehttp)
DEBUG: Writing AT command "b'AT+HTTPTERM\r\n'"
DEBUG: Read "b'AT+HTTPTERM\r\r\n'"
DEBUG: Read "b'OK\r\n'"
DEBUG: Detected exact end
DEBUG: Returning "b''"
Response status code: 606
Response content:
I think that "problem" is probably on my server, but unfortunately i don't understand, how to prepare my endpoint for request from your modem driver.
Please, can you help me with server response what you expecting it?
Thank you for your support.
Lukas Sliacky
Hi guys, first of all: Thanks for your great project...
I am using your driver located here: Drivers/SIM800L.py
I don't know where can be a problem and i am writing here entire my scenario and specific information which i know:
I am using latest version:
and my device is connected on Internet:
All these my experiments are okay.
And here is my problem:
My webserver is based on Flask (with NGINX server) and i have simple and basic endpoint:
When i try simple request to my API with requests library ("normal" Python 3.5+):
And everything looks good...
But when i try similar request to API over my TTGO T-Call SIM800 with code:
i see response:
A am pasting here all info from your additional log:
I think that "problem" is probably on my server, but unfortunately i don't understand, how to prepare my endpoint for request from your modem driver.
Please, can you help me with server response what you expecting it?
Thank you for your support.
Lukas Sliacky