add auth check
This commit is contained in:
@@ -11,7 +11,7 @@ import datetime
|
||||
import threading
|
||||
import requests
|
||||
|
||||
from api import base_url, data_record_url, the_folder
|
||||
from api import device_post, the_folder
|
||||
|
||||
|
||||
class DataCollector:
|
||||
@@ -47,12 +47,11 @@ class DataCollector:
|
||||
def _upload_to_server(self, data_bytes: bytes, filename: str, folder: str) -> bool:
|
||||
"""向 ReinLoop 云服务器申请上传地址并上传控制数据。"""
|
||||
try:
|
||||
resp = requests.post(data_record_url, json={
|
||||
result = device_post({
|
||||
"type": "uploadDataFile",
|
||||
"fileName": filename,
|
||||
"folder": folder,
|
||||
}, timeout=30)
|
||||
result = resp.json()
|
||||
except Exception as e:
|
||||
self.log(f"向云服务器申请上传地址异常: {e}")
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user