This commit is contained in:
PaulVua
2025-01-15 19:22:12 +01:00
parent 75c839a2a3
commit eaf3a2a567
3 changed files with 434 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
'''
Script to set the URL for a HTTP request and trigger the POST Request
Ex:
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS.py ttyAMA2 aircarto.fr
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS.py ttyAMA2 api-prod.uspot.probesys.net
To do: need to add profile id as parameter
@@ -24,7 +24,7 @@ parameter = sys.argv[1:] # Exclude the script name
port='/dev/'+parameter[0] # ex: ttyAMA2
url = parameter[1] # ex: data.mobileair.fr
profile_id = 0
profile_id = 3
#get baudrate
def load_config(config_file):
@@ -113,16 +113,16 @@ try:
print(response_SARA_55)
time.sleep(1)
#step 4: set url to SSL (op_code = 6)
#step 4: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS)(USECMNG_PROFILE = 2)
print("****")
print("SET SSL")
command = f'AT+UHTTP={profile_id},6,1,2\r'
command = f'AT+UHTTP={profile_id},6,1\r'
ser_sara.write(command.encode('utf-8'))
response_SARA_5 = read_complete_response(ser_sara)
print(response_SARA_5)
time.sleep(1)
#step 4: trigger the request
#step 4: trigger the request (http_command=1 for GET)
print("****")
print("Trigger POST REQUEST")
command = f'AT+UHTTPC={profile_id},1,"/tests/test.php","https.resp"\r'
@@ -130,10 +130,6 @@ try:
ser_sara.write(command.encode('utf-8'))
#response_SARA_6 = read_complete_response(ser_sara, timeout=5)
#print(response_SARA_6)
#time.sleep(1)
# Wait for the +UUHTTPCR response
print("Waiting for +UUHTTPCR response...")