def __init__(self, cik_lookup, filing_type, start_date=None, end_date=datetime.datetime.today(), client=None, count=None, **kwargs): # Leave params before other setters self._params = { 'action': 'getcompany', 'output': 'xml', 'owner': 'include', 'start': 0, } self._accession_numbers = [] self.start_date = start_date self.end_date = end_date self.filing_type = filing_type # make CIKLookup object for users if not given self.cik_lookup = cik_lookup self.count = count # Make default client NetworkClient and pass in kwargs self._client = client if client is not None else NetworkClient( **kwargs)
def __init__(self, cik_lookup, filing_type, start_date=None, end_date=datetime.datetime.today(), client=None, **kwargs): self._start_date = start_date self._end_date = end_date self._accession_numbers = [] if not isinstance(filing_type, FilingType): raise FilingTypeError self._filing_type = filing_type # make CIKLookup object for users if not given if not isinstance(cik_lookup, CIKLookup): cik_lookup = CIKLookup(cik_lookup) self._cik_lookup = cik_lookup self._params = { 'action': 'getcompany', 'dateb': sanitize_date(self.end_date), 'output': 'xml', 'owner': 'include', 'start': 0, 'type': self.filing_type.value } if kwargs.get('count') is not None: self._params['count'] = kwargs.get('count') if start_date is not None: self._params['datea'] = sanitize_date(start_date) # Make default client NetworkClient and pass in kwargs self._client = client if client is not None else NetworkClient( **kwargs)
def __init__(self, lookups, client=None, **kwargs): # Make sure lookups is not empty string if lookups and isinstance(lookups, str): self._lookups = [lookups] # make single string into list else: # Check that iterable only contains strings and is not empty if not (lookups and all(type(o) is str for o in lookups)): raise TypeError("CIKs must be given as string or iterable.") self._lookups = lookups self._params = {'action': 'getcompany'} self._client = client if client is not None else NetworkClient( **kwargs)
def __init__(self, lookups, client=None, **kwargs): if isinstance(lookups, str): self._lookups = [lookups] # make single string into list else: try: # Check that iterable only contains strings and is not empty if not lookups or not all(type(o) is str for o in lookups): raise TypeError self._lookups = lookups except TypeError: raise TypeError("CIKs must be given as string or iterable.") self._params = {'action': 'getcompany'} if client is None: self._client = NetworkClient(**kwargs)