Skip to content

Commit db532c6

Browse files
Create MeasureAPIMetrics.py
1 parent 578b35d commit db532c6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

MeasureAPIMetrics.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
3+
API_ENDPOINT = "https://api.example.com/metrics"
4+
5+
def check_api_metrics():
6+
response = requests.get(API_ENDPOINT)
7+
response.raise_for_status()
8+
data = response.json()
9+
metric1 = data['metric1']
10+
metric2 = data['metric2']
11+
if metric1 > 1000:
12+
print("Metric1 is higher than expected.")
13+
if metric2 < 50:
14+
print("Metric2 is lower than expected.")
15+
16+
check_api_metrics()

0 commit comments

Comments
 (0)