-
Notifications
You must be signed in to change notification settings - Fork 91
/
run.py
36 lines (23 loc) 路 1006 Bytes
/
run.py
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
28
29
30
31
32
33
34
35
36
### PYTHON NATIVE DEPENDENCIES
import json
### DEPENDENCIES TO IMPORT ON THE GH WORKFLOW
import requests
### SCRIPT SAMPLE EXECUTED THROUGH GH WORKFLOW
print(f"馃挕 \033[36mScript example: Getting Brazil Covid-19 datas\033[0m")
try:
response1 = requests.get("https://covid-api.mmediagroup.fr/v1/cases?country=Brazil")
country_datas = response1.json()
cases = country_datas["All"]
print("馃 馃嚙馃嚪 Confirmed cases:", cases["confirmed"])
print("馃コ 馃嚙馃嚪 Recovered cases:", cases["recovered"])
print("馃槩 馃嚙馃嚪 Deaths:", cases["deaths"])
except:
print("Couldn't extract Brazil cases datas")
try:
response2 = requests.get("https://covid-api.mmediagroup.fr/v1/vaccines?country=Brazil")
vaccines_datas = response2.json()
vaccines = vaccines_datas["All"]
print("馃摝 馃嚙馃嚪 Vaccines quantity:", vaccines["administered"])
print("馃拤 馃嚙馃嚪 Vaccinated people:", vaccines["people_vaccinated"])
except:
print("Couldn't extract Brazil vaccines datas")