blob: 4d4691859ea7a32bb6c4d30d7c8bc4b608f6b5fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import json
import os
__filename__ = 'device-auth.json'
class DeviceAuth:
def device_auth_file_exists(self):
return os.path.isfile(__filename__)
def get_device_auth_details(self):
if os.path.isfile(__filename__):
with open(__filename__, 'r') as fp:
return json.load(fp)
return {}
def store_device_auth_details(self, email, details):
existing = self.get_device_auth_details()
existing[email] = details
with open(__filename__, 'w') as fp:
json.dump(existing, fp)
|