I am trying to fix this code where I'm trying to get table from SEC website of this company
Libraries:
# import our libraries
import requests
import pandas as pd
from bs4 import BeautifulSoup
Definition of parameters for search:
# base URL for the SEC EDGAR browser
endpoint = r"https://www.sec.gov/cgi-bin/browse-edgar"
# define our parameters dictionary
param_dict = {'action':'getcompany',
'CIK':'1265107',
'type':'10-k',
'dateb':'20190101',
'owner':'exclude',
'start':'',
'output':'',
'count':'100'}
# request the url, and then parse the response.
response = requests.get(url = endpoint, params = param_dict)
soup = BeautifulSoup(response.content, 'html.parser')
# Let the user know it was successful.
print('Request Successful')
print(response.url)
This is where the problem is, when I try to loop over the content of the table i get error shown below as if the table does not exist.
# find the document table with our data
doc_table = soup.find_all('table', class_='tableFile2')
# define a base url that will be used for link building.
base_url_sec = r"https://www.sec.gov"
master_list = []
# loop through each row in the table.
for row in doc_table[0].find_all('tr'):
The error:
Here is the link to the website I am trying to scrape https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=1265107&type=10-k&dateb=20190101&owner=exclude&start=&output=&count=100 When I inspect the elements of the website I can't find anything that could cause this error.
Thank you for any help.
