I am working on a project to find the latest 10K filings url for a company using CIK number. Please find the code below:
import requests
from bs4 import BeautifulSoup
# CIK number for Apple is 0001166559
cik_number = "0001166559"
url = f"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK={cik_number}&type=10-K&dateb=&owner=exclude&count=40"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
# Find the link to the latest 10-K filing
link = soup.find('a', {'id': 'documentsbutton'})
filing_url = link['href']
print(filing_url)
I am getting HTTP 403 error. Please help me
Thanks