Skip to content

Commit

Permalink
Added sic, state, url
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyism committed Dec 8, 2019
1 parent 0ab8fc6 commit 04cafb4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion edgar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]
11 changes: 10 additions & 1 deletion edgar/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 04cafb4

Please sign in to comment.