bramw commited on
Commit
1a4ea1a
1 Parent(s): 878881e

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +27 -0
utils.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+
4
+ class Endpoint:
5
+ def __init__(self):
6
+ self._url = None
7
+
8
+ @property
9
+ def url(self):
10
+ if self._url is None:
11
+ self._url = self.get_url()
12
+
13
+ return self._url
14
+
15
+ def get_url(self):
16
+ endpoint = os.environ.get("endpoint")
17
+
18
+ return endpoint
19
+
20
+
21
+ def get_token():
22
+ token = os.environ.get("auth_token")
23
+
24
+ if token is None:
25
+ raise ValueError("auth-token not found in environment variables")
26
+
27
+ return token