Key Error in Unit Testing

def check_whether_message_is_published(self, message, image_path):
user_feeds = self.get_user_feed()

    if 'error' in user_feeds:
        print("\n\n",json.dumps(user_feed, indent=4))
        return False
    for feed in user_feeds['data']:
        if 'attachments' in feed:
          if feed['message'] == message:

E KeyError: ‘message’

tests/test_views.py:82: KeyError

print (response.status_code, response.json())
200 {‘id’: ‘123813602481650’}

Make sure not to hard code the values
Also refer this post:

I’m also getting same error… but could not understand solution part… basically was’nt it
instructed in todo to hardcode url and other parameters … Moreover to debug when i opened test_view.py got many error solved some of them … but had no clue with download_file and binary_image_compare method…