Skip to content
Snippets Groups Projects

Api authentication

Merged Callum Inglis requested to merge UAT into main
2 files
+ 9
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -46,6 +46,8 @@ from SX127x.LoRaArgumentParser import LoRaArgumentParser
from SX127x.board_config import BOARD
import SX127x.packer as packer
import secrets
DEBUG = 1
API_URL = "https://emiei.4oh4.co/api"
MAX_TX_RESERVATION_TIME = 2 # Seconds
@@ -72,6 +74,7 @@ class RxHello(object):
class SensorResponse(object):
def __init__(self, sensorMetadata, data):
self.gateway = Gateway()
self.sensorMetadata = SensorMetadata(**sensorMetadata)
self.sensorReading = SensorReading(**data)
@@ -86,6 +89,11 @@ class SensorResponse(object):
print(response) # Ensure 200 Response!
return
class Gateway(object):
def __init__(self):
self.gatewayUID = getserial()
self.apiKey = secrets.API_KEY
class SensorMetadata(object):
def __init__(self, uid, messageID, samplePeriod):
self.uid = uid
Loading