This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import difflib | |
import json | |
import os | |
import re | |
import requests | |
import sys | |
from datetime import datetime, timedelta | |
from pprint import pprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.8 | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
ADD main.py / | |
ADD requirements.txt / | |
# Set up and activate virtual environment | |
ENV VIRTUAL_ENV "/venv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Fetchs COVID-19 spread data from 4 sources: | |
1. CSSE at JHU ArcGIS, | |
2. CSSE at JHU github repo | |
3. Worldometer website | |
4. Manual Input from Google Spreadsheet | |
Combines the data and uploads on a Amazon S3-type Cloud-Storage | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Fetch and parse data from Google Spreadsheet CSV | |
Requires requests package to be installed: pip install requests | |
Spreadsheet URL: https://docs.google.com/spreadsheets/d/10Xlr25Qtb-sRDJPqX66zqPPEP8yignUsPxxhT0O9Zb0/edit?usp=sharing | |
CSV export URL: https://docs.google.com/spreadsheets/d/e/2PACX-1vSZ_YhO6H0Q-dBX1sifVmDN9nonyx0xBePvqsU6NdsJJVO-B1MdBRXRCjHo9NBlYpl96AZai8_HGXKa/pub?gid=0&single=true&output=csv | |
""" | |
from io import StringIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
# Initialize a bs4 instance with a HTML-source | |
page_dom = BeautifulSoup(page_html, "html.parser") | |
# Iterate over all DIVs with class hentry_event | |
for line in page_dom.find_all('div', class_="hentry_event"): | |
# Find first A inside the DIV and get innerText | |
title = line.find('a').contents[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Retrieving Vladimir Putin's interviews from Kremlin website | |
response = requests.get('http://en.kremlin.ru/search', params={'query': 'interview'}, timeout=40) | |
# Checking response status code | |
if response.status_code == requests.codes.ok: | |
# Output response content as a string | |
print response.text | |
else: |