Category Archives: Python

Pennsylvania COVID-19 Data Scraping with Python

Over the last few weeks I've been using Python to scrape the Pennsylvania Department of Health's Coronavirus page. Over time the page has evolved and even split into sub-pages which contain table date of cases, deaths and other statistics. I've decided to put my Python script on GitHub for public consumption. Initially when I had created the script, it was used to send me alerts when the reported numbers changed as there was no set time during the day that the website was updated, so I wanted Continue reading →

Login to WordPress from Python

I've been trying to learn some Python and have been tinkering with the requests module. Here is how I am able to log into a webpage, such as WordPress. import requests url = "https://techish.net/wp-login.php" redirect_to = "https://techish.net/wp-admin/" with requests.Session() as session: post = session.post(url, data={ 'log': 'admin', 'pwd': 'password', 'redirect_to': redirect_to }, allow_redirects=True) get = session.get(redirect_to, cookies=post.cookies) Continue reading →