The following works
tables = c.acs5.tables(year=2020)
fields = c.acs5.fields(year=2020)
The following raises a json decode error from a 404 response
fields = c.acs5.fields(year=2020)
This is because ACSClient.tables calls _switch_endpoints which mutates the state of the client. which ACSClient.fields does not. The simplest hotfix is to add the following code to ACSClient
def fields(self, *args, **kwargs):
self._switch_endpoints(kwargs.get("year", self.default_year))
return super(ACSClient, self).fields(*args, **kwargs)
But I highly suggest removing the mutable state from ACSClient.
The following works
The following raises a json decode error from a 404 response
This is because
ACSClient.tablescalls_switch_endpointswhich mutates the state of the client. whichACSClient.fieldsdoes not. The simplest hotfix is to add the following code toACSClientBut I highly suggest removing the mutable state from
ACSClient.