-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (17 loc) · 654 Bytes
/
main.py
File metadata and controls
27 lines (17 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pathlib
import requests
from app.core.config_manager import ConfigManager
confFilePath = pathlib.Path.cwd() / "app" / "conf" / "config.ini"
configManager = ConfigManager()
print("Your API URL is : " + configManager.config["APP"]["API_URL"])
API_URL = configManager.config["APP"]["API_URL"]
def contactAPI():
try:
response = requests.get(API_URL + "YOUR_API_ENDPOINT")
print(response.json())
except requests.exceptions.InvalidSchema:
print(
"Requests could not find the API. Are you sure you replaced the API url in the config.ini file ??"
)
if __name__ == "__main__":
contactAPI()