コード例 #1
0
 def load_json(path):
     # esse é o id atual, mas pode mudar com o tempo
     app_id = "unAFkcaNDeXajurGB7LChj8SgQYS2ptm"
     response = http_get(
         "https://xx9p7hp1p7.execute-api.us-east-1.amazonaws.com/prod/{}".
         format(path), {"x-parse-application-id": app_id})
     if response:
         return json.loads(response.read())
コード例 #2
0
 def load():
     global _oms_data
     response = http_get(
         "https://dashboards-dev.sprinklr.com/data/9043/global-covid19-who-gis.json",
         {"Accept-Encoding": "gzip"})
     if response:
         response_data = decompress(response.read())
         data = json.loads(response_data.decode("utf-8"))
         _oms_data = [d for d in data["rows"] if d[1] == "BR"]
コード例 #3
0
ファイル: brasil_io.py プロジェクト: pagotti/corona-bot
 def load_series():
     result_data = []
     next_page = "https://brasil.io/api/dataset/covid19/caso/data?place_type=state"
     while next_page:
         response = http_get(next_page)
         if response:
             data = json.loads(response.read())
             result_data.extend(data["results"])
             next_page = data.get("next")
         else:
             break
     return result_data
コード例 #4
0
ファイル: brasil_io.py プロジェクト: pagotti/corona-bot
 def load_region_series(region_code):
     result_data = []
     next_page = "https://brasil.io/api/dataset/covid19/caso/data?city_ibge_code={}".format(
         region_code)
     while next_page:
         response = http_get(next_page)
         if response:
             data = json.loads(response.read())
             result_data.extend(data["results"])
             next_page = data.get("next")
         else:
             break
     return result_data
コード例 #5
0
ファイル: brasil_io.py プロジェクト: pagotti/corona-bot
 def load():
     global _raw_data
     raw_data = []
     next_page = "https://brasil.io/api/dataset/covid19/caso/data?is_last=True"
     while next_page:
         response = http_get(next_page)
         if response:
             data = json.loads(response.read())
             raw_data.extend(data["results"])
             next_page = data.get("next")
         else:
             break
     _raw_data = raw_data
コード例 #6
0
 def load():
     global _world_data
     response = http_get("https://www.worldometers.info/coronavirus/")
     if response:
         main_page = BeautifulSoup(response, 'html.parser')
         last_date_tag = main_page.find(
             WorldOMeterData._last_update_matcher)
         if last_date_tag:
             match = re.findall(r"(\w+\s\d+,\s\d+,\s\d+:\d+\sGMT)$",
                                last_date_tag.text)
             if match:
                 _world_data["lastUpdated"] = match[0]
         data_tag = main_page.find(WorldOMeterData._brazil_matcher)
         cols = []
         for el in data_tag.parent.find_next_siblings("td"):
             cols.append(el.text)
         if cols:
             _world_data["cases"] = cols[0]
             _world_data["deaths"] = cols[2]
             _world_data["recovery"] = cols[4]
コード例 #7
0
ファイル: g1.py プロジェクト: pagotti/corona-bot
 def load():
     global _g1_data
     url = "https://api.especiaisg1.globo/api/eventos/brasil/"
     response = http_get(url)
     if response:
         _g1_data = json.loads(response.read())