Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, key, year=None, session=None):
if not session:
session = new_session()
self.session = session
self.session.headers.update({
'User-Agent': ('python-census/{} '.format(__version__) +
'github.com/datamade/census')
})
self._acs = ACS5Client(key, year, session) # deprecated
self.acs5 = ACS5Client(key, year, session)
self.acs3 = ACS3Client(key, year, session)
self.acs1 = ACS1Client(key, year, session)
self.acs5dp = ACS5DpClient(key, year, session)
self.acs3dp = ACS3DpClient(key, year, session)
self.acs1dp = ACS1DpClient(key, year, session)
self.sf1 = SF1Client(key, year, session)
self.sf3 = SF3Client(key, year, session)
class ACS3Client(ACSClient):
default_year = 2013
dataset = 'acs3'
years = (2013, 2012)
@supported_years()
def state_county_subdivision(self, fields, state_fips,
county_fips, subdiv_fips, **kwargs):
return self.get(fields, geo={
'for': 'county subdivision:{}'.format(subdiv_fips),
'in': 'state:{} county:{}'.format(state_fips, county_fips),
}, **kwargs)
class ACS3DpClient(ACS3Client):
dataset = 'acs3/profile'
class ACS1Client(ACSClient):
default_year = 2017
dataset = 'acs1'
years = (2017, 2016, 2015, 2014, 2013, 2012, 2011)
@supported_years()
def state_county_subdivision(self, fields, state_fips,
county_fips, subdiv_fips, **kwargs):
return self.get(fields, geo={
'for': 'county subdivision:{}'.format(subdiv_fips),