facebook-insights
facebook-insights copied to clipboard
KeyError: 'type' -> --> 302 self.type = raw['type'] in graph.pyc
KeyError Traceback (most recent call last)
C:\ProgramData\Anaconda2\lib\site-packages\facebookinsights-0.3.4-py2.7.egg\facebookinsights\graph.pyc in get(self) 81 for page in pages: 82 for post in page['data']: ---> 83 post = Post(self.edge, post) 84 85 # For date ranges, we can't rely on pagination
C:\ProgramData\Anaconda2\lib\site-packages\facebookinsights-0.3.4-py2.7.egg\facebookinsights\graph.pyc in init(self, page, raw) 300 self.graph = page.graph.partial(raw['id']) 301 self.id = raw['id'] --> 302 self.type = raw['type'] 303 self.created_time = utils.date.parse(raw['created_time']) 304 self.updated_time = utils.date.parse(raw['updated_time'])
KeyError: 'type'
Any ideas? Did something change with in the Graph API
Yes, seems to me it did.
So the code is assuming updated_time exist on raw array, when it doesn't.
What I did was changing line to
self.type = raw.get('type')
on graph.py and the error doesn't happen.
Btw, it's the same if I comment the line.
I also had to do same thing for the line
self.updated_time = raw.get('updated_time')
Type is deprecated since v3.3 of the graph API. There is a field called status_type
with similar information.
I reckon a PR to just remove it should be welcome (not that I manage this).