diff --git a/edgar/__init__.py b/edgar/__init__.py index 739fa83..6be43cf 100644 --- a/edgar/__init__.py +++ b/edgar/__init__.py @@ -4,7 +4,7 @@ from .txtml import TXTML from .company import Company -__version__ = "3.0.1" +__version__ = "4.0.0" modules = glob.glob(dirname(__file__)+"/*.py") __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')] diff --git a/edgar/company.py b/edgar/company.py index 176b578..9b4ff01 100644 --- a/edgar/company.py +++ b/edgar/company.py @@ -8,9 +8,18 @@ class Company(): def __init__(self, name, cik): self.name = name self.cik = cik + self.url = f"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK={cik}" + self._get_company_info() + + def _get_company_info(self): + page = html.fromstring(requests.get(self.url).content) + companyInfo = page.xpath("//div[@class='companyInfo']")[0] + indentInfo = companyInfo.getchildren()[1] + self.sic = indentInfo.getchildren()[1].text + self.us_state = indentInfo.getchildren()[3].text def _get_filings_url(self, filing_type="", prior_to="", ownership="include", no_of_entries=100): - url = "https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=" + self.cik + "&type=" + filing_type + "&dateb=" + prior_to + "&owner=" + ownership + "&count=" + str(no_of_entries) + url = self.url + "&type=" + filing_type + "&dateb=" + prior_to + "&owner=" + ownership + "&count=" + str(no_of_entries) return url def get_all_filings(self, filing_type="", prior_to="", ownership="include", no_of_entries=100):