Open jasonminsookim opened 6 years ago
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)
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
list(session.matches())
File "/Users/jasonkim/PycharmProjects/JynderBot/venv/lib/python3.5/site-packages/pynder/session.py", line 48, in
return (Match(match, self) for match in response if 'person' in match)
File "/Users/jasonkim/PycharmProjects/JynderBot/venv/lib/python3.5/site-packages/pynder/models/user.py", line 135, in init
match['person']['_id'])['results']
File "/Users/jasonkim/PycharmProjects/JynderBot/venv/lib/python3.5/site-packages/pynder/api.py", line 120, in user_info
return self._get("/user/" + user_id)
File "/Users/jasonkim/PycharmProjects/JynderBot/venv/lib/python3.5/site-packages/pynder/api.py", line 52, in _get
return self._request("get", url)
File "/Users/jasonkim/PycharmProjects/JynderBot/venv/lib/python3.5/site-packages/pynder/api.py", line 46, in _request
raise errors.RequestError(result.status_code)
pynder.errors.RequestError: 400