pynder.errors.RequestError: 400
Here's the code I used:
`session = pynder.Session(facebook_id=myId, facebook_token=myToken)
list(session.matches())`
Here's the error I got:
Traceback (most recent call last):
File "/Users/jasonkim/PycharmProjects/JynderBot/brainstorming.py", line 8, in
Hi, there are new "users" (advertisement) that cause problems. I put serveral methods into try / except blocks to handle the error.
Change the pynder code in user.py to something like this and it should work:
if 'person' in match:
try:
_id = match['person']['_id']
user_data = _session._api.user_info(_id)['results']
user_data['_id'] = _id
self.user = User(user_data, _session)
self.messages = [
Message(m, user=self.user)
for m in match['messages']
]
except Exception as e:
print("Not normal user: Advertisement / Deleted: " + str(e))
The error still persists even after making the code change you suggested.
`RequestError Traceback (most recent call last)
//anaconda3/lib/python3.7/site-packages/cached_property.py in get(self, obj, cls) 33 return self._wrap_in_coroutine(obj) 34 ---> 35 value = obj.dict[self.func.name] = self.func(obj) 36 return value 37
//anaconda3/lib/python3.7/site-packages/pynder/session.py in profile(self) 20 @cached_property 21 def profile(self): ---> 22 return Profile(self._api.profile(), self._api) 23 24 def nearby_users(self, limit=10):
//anaconda3/lib/python3.7/site-packages/pynder/api.py in profile(self) 66 67 def profile(self): ---> 68 return self._get("/profile") 69 70 def update_profile(self, profile):
//anaconda3/lib/python3.7/site-packages/pynder/api.py in _get(self, url) 45 46 def _get(self, url): ---> 47 return self._request("get", url) 48 49 def _post(self, url, data={}):
//anaconda3/lib/python3.7/site-packages/pynder/api.py in _request(self, method, url, data) 39 url), data=data, proxies=self._proxies) 40 if result.status_code < 200 or result.status_code >= 300: ---> 41 raise errors.RequestError(result.status_code) 42 if result.status_code == 201 or result.status_code == 204: 43 return {}
RequestError: 400`
Pynder version: 0.0.13