-
Notifications
You must be signed in to change notification settings - Fork 102
/
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")