-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |