Remove python data transfer script
This commit is contained in:
parent
d7b5366bdc
commit
7a7bf4a6b4
@ -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"
|
||||||
|
@ -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)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user