This commit is contained in:
Your Name
2025-01-24 15:21:57 +01:00
parent 4123f977b2
commit c8b9cb46f6

View File

@@ -1,9 +1,9 @@
''' '''
Script to set the URL for a HTTP request and trigger the POST Request Script to set the URL for a HTTP request and trigger the POST Request
Ex: Ex:
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 api-prod.uspot.probesys.net /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 api-prod.uspot.probesys.net /nebuleair?token=2AFF6dQk68daFZ
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 webhook.site /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 webhook.site /13502b8b-201a-41ea-ae33-983516074de5
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 aircarto.fr /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 aircarto.fr /tests/test.php
First profile id: First profile id:
@@ -24,6 +24,7 @@ parameter = sys.argv[1:] # Exclude the script name
#print("Parameters received:") #print("Parameters received:")
port='/dev/'+parameter[0] # ex: ttyAMA2 port='/dev/'+parameter[0] # ex: ttyAMA2
url = parameter[1] # ex: data.mobileair.fr url = parameter[1] # ex: data.mobileair.fr
endpoint = parameter[2]
profile_id = 2 profile_id = 2
#get baudrate #get baudrate
@@ -258,8 +259,10 @@ try:
#step 4: trigger the request (http_command=1 for GET and http_command=1 for POST) #step 4: trigger the request (http_command=1 for GET and http_command=1 for POST)
print("****") print("****")
print("\033[0;33mPOST REQUEST\033[0m") print("\033[0;33mPOST REQUEST\033[0m")
#parameter (POST)
command = f'AT+UHTTPC={profile_id},4,"{endpoint}","https.resp","sensordata_json.json",4\r'
#AIRCARTO #AIRCARTO
command = f'AT+UHTTPC={profile_id},4,"/tests/test.php","https.resp","sensordata_json.json",4\r' #command = f'AT+UHTTPC={profile_id},4,"/tests/test.php","https.resp","sensordata_json.json",4\r'
#uSPOT #uSPOT
#command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","https.resp","sensordata_json.json",4\r' #command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","https.resp","sensordata_json.json",4\r'
#AtmoSud #AtmoSud
@@ -323,8 +326,9 @@ try:
3 HTTP Protocol error class 3 HTTP Protocol error class
10 Wrong HTTP API USAGE 10 Wrong HTTP API USAGE
error_code error_code (for error_class 3)
0 No error 0 No error
11 Server connection error
73 Secure socket connect error 73 Secure socket connect error
''' '''