Remove python data transfer script

This commit is contained in:
Kai S. K. Engelbart 2021-03-11 17:26:07 +01:00
parent d7b5366bdc
commit 7a7bf4a6b4
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 0 additions and 35 deletions

View File

@ -17,7 +17,5 @@ done < $1
JSON=${JSON::-2} JSON=${JSON::-2}
JSON+=']}' JSON+=']}'
echo "JSON = $JSON"
# Dispatch curl # Dispatch curl
curl -X POST $URL -H "accept: */*" -H "hono-ttd: $TTD" -H "Authorization: Basic $KEY" -H "Content-Type: application/json" -d "$JSON" curl -X POST $URL -H "accept: */*" -H "hono-ttd: $TTD" -H "Authorization: Basic $KEY" -H "Content-Type: application/json" -d "$JSON"

View File

@ -1,33 +0,0 @@
import requests
import sys
import re
file_name = sys.argv[1]
print(file_name)
dptFile = open(file_name, 'r')
lines = dptFile.readlines()
subject = re.split("(?<=_)(.+)(?=\.)", file_name)[1]
jsonString = '{\" + subject + \": ['
# Concatenate data
for line in lines:
content = line.split(',')
jsonString += '[' + str(content[0]) + ', ' + str(content[1].strip()) + '],'
# Remove last comma
jsonString = jsonString[:-1]
jsonString += ']}'
headers = {
'accept': '*/*',
'hono-ttd': '10',
'Authorization': 'Basic ZGVmaW5tYUB0MzhiYmNjZDE2MjE3NDViODgxMTk5ZGI2ZWQzZGFiNmE6RGVGaW5NYWNoZW4yMDIwIQ==',
'Content-Type': 'application/json',
}
response = requests.post('https://http.bosch-iot-hub.com/telemetry', headers=headers, data=jsonString)
print(response)