Skip to content

KeyError: 'resource' when revision.apply() tries to get the old resource #81

@bdklahn

Description

@bdklahn

I'm trying to figure out if this is an issue the the endpoint (maybe no longer having a 'resource' associated), or with this library not waiting long enough for a long response, or . . .. Because a newly-created four-four loaded with this data works. But I wonder if the 'resource' key for the older four-four holds more metadata, which socrata-py is not waiting long enough for the endpoint to retrieve.

Here are the relevant traceback lines.

"""
---> 46 job = revision.apply()
47
48 return revision, job

/venv/lib64/python3.8/site-packages/socrata/resource.py in f(*args, **kwargs)
152 old = getattr(self, og_method_name, self._noop)
153 def f(*args, **kwargs):
--> 154 return old(uri, *args, **kwargs)
155 return f
156

/venv/lib64/python3.8/site-packages/socrata/revisions.py in apply(self, uri, output_schema)
393 })
394
--> 395 result = self._subresource(Job, put(
396 self.path(uri),
397 auth = self.auth,

/venv/lib64/python3.8/site-packages/socrata/resource.py in _subresource(self, klass, res, **kwargs)
115
116 def _subresource(self, klass, res, **kwargs):
--> 117 return klass(self.auth, res, self, **kwargs)
118
119 def _subresources(self, klass, resources):

/venv/lib64/python3.8/site-packages/socrata/resource.py in init(self, auth, response, parent, *args, **kwargs)
76 def init(self, auth, response, parent = None, *args, **kwargs):
77 self.auth = auth
---> 78 self._on_response(response)
79 self.parent = parent
80

/venv/lib64/python3.8/site-packages/socrata/resource.py in _on_response(self, response)
93
94 def _on_response(self, response):
---> 95 self.attributes = response['resource']
96 self.links = response['links']
97 self._define_operations(self.links)

KeyError: 'resource'

"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions