Skip to content

Commit

Permalink
Create autonomous_vehicle.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 27, 2024
1 parent c212d3b commit d254b9e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions iot-integration/iot_devices/autonomous_vehicle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import requests

class AutonomousVehicleDevice:
def __init__(self, device_id, device_token):
self.device_id = device_id
self.device_token = device_token

def make_payment(self, amount):
# Make a request to the autonomous vehicle API to make a payment
response = requests.post(f'https://autonomous-vehicle-api.com/payments/{self.device_id}', json={'amount': amount}, headers={'Authorization': f'Bearer {self.device_token}'})
return response.json()

def get_vehicle_data(self):
# Make a request to the autonomous vehicle API to retrieve vehicle data
response = requests.get(f'https://autonomous-vehicle-api.com/vehicles/{self.device_id}', headers={'Authorization': f'Bearer {self.device_token}'})
return response.json()

0 comments on commit d254b9e

Please sign in to comment.