def find_company_by_names_fuzzy(self, names): """ Requests EDGAR for a company by name pattern to obtain a list of potentials :param names: A pattern for a name :return: None. Prints list of possible matches """ if len(names) != 0: edgar = Edgar() for n in names: if not "".__eq__(n): possible_companies = edgar.find_company_name(n) for pc in possible_companies: cik = edgar.get_cik_by_company_name(pc) # Provide more details to help choose the right one if self.aconfig['args'].edgar_company_names_fuzzy_detail: print("\nName/CIK: {0}:{1}".format(pc, cik)) cik_feed = self.aconfig['args'].endpoint + \ "/cgi-bin/browse-edgar?action=getcompany&CIK=" + \ cik + "&output=atom" try: response = requests.get(cik_feed) od = xmltodict.parse(response.content) state_inc = od['feed']['company-info']['state-of-incorporation'] state_loc = od['feed']['company-info']['state-location'] print("{0:>10} : {1}/{2}".format("State Incorporated/State Located", state_inc, state_loc)) print("{0:>5}".format("Addresses:")) for k, addresses in od['feed']['company-info']['addresses'].items(): for addr in addresses: print() for k, v in addr.items(): print("{0:>10} {1}".format(k,v)) except requests.ConnectionError as ce: print("Error fetching atom feed: ", ce) except xml.parsers.expat.ExpatError as xe: print("Error fetching atom feed: ", xe) print("---") else: print("{0}:{1}".format(pc, cik)) else: print("Skipping empty name") else: print("No names provided (-N option)")
from edgar import Edgar edgar = Edgar() possible_companies = edgar.find_company_name("Cisco System")
from edgar import Edgar edgar = Edgar() possible_companies = edgar.find_company_name("microsoft corp") print(possible_companies) # edgar.download_index("/home/sroot/kaizha/temp/", 2020, skip_all_present_except_last=Tr print(edgar.get_company_name_by_cik("0000789019"))