Py-StackExchange icon indicating copy to clipboard operation
Py-StackExchange copied to clipboard

Error when sometimes fetching comments from answers.

Open goldiiman opened this issue 9 years ago • 0 comments

I sometimes get an error when I fetch the comments from answers

It complains of missing key user_id, so the json must have an owner attr but the owner not have a user_id. this was the json that failed so explains the error, I added try / except but it would nice to know about the issue (closed user account?)

{'display_name': 'user****', 'user_type': 'does_not_exist'}

        if hasattr(json, 'owner'):
            try:
                self.owner_id = json.owner['owner_id'] if 'owner_id' in json.owner else json.owner['user_id']

goldiiman avatar Nov 06 '16 21:11 goldiiman