This repository contains two Python scripts for scraping the SEC Edgar database for 8-K forms that mention "Material Cybersecurity" within the last 30 days.
This script scrapes the data and saves it to a CSV file.
This script scrapes the data, saves it to a CSV file, includes the data in the body of an email, and sends the email with the CSV file as an attachment using SendGrid.
If you want to only have the csv sent as an attachment remove the following portion of edgar8kemail.py
# Attach the HTML content to the email
msg.attach(MIMEText(html, 'html'))
The edgar8kemail-internalsmtp.py
script is used to scrape data from the SEC's EDGAR database and send the results via email using an internal SMTP server. Includes the data in the body of an email, and sends the email with the CSV file as an attachment
- Python 3.6+
- Selenium
- BeautifulSoup
- pandas
- SendGrid (only for
edgar8kemail.py
)
- Clone this repository.
- Install the required packages with
pip install -r requirements.txt
.
- Set your SendGrid API key, sender email, and recipient email in
mysecrets.py
(only foredgar8kemail.py
). - Set your internal SMTP variables in
mysecrets.py
(only foredgar8kemail-internalsmtp.py
)SMTP_SERVER
: Your SMTP serverSMTP_PORT
: Your SMTP portSMTP_USERNAME
: Your SMTP usernameSMTP_PASSWORD
: Your SMTP passwordSENDER_EMAIL
: The email address to send the emails fromRECIPIENT_EMAIL
: The email address to send the emails to
- Run the desired script with
python3 <script_name>
.
The scripts will create a CSV file named Edgar 8k 1.05 Results.csv
with the scraped data. edgar8kemail.py
and edgar8kemail-internalsmtp.py
will also send an email with the CSV file as an attachment and the data in the body of the email.
This project is licensed under the terms of the GNU General Public License v3.0.