Closed motobeerx closed 3 years ago
the happens on 39 line. the fol['item'] is a list of dictionaries, and the key error happens because of : In: for x in self.__postman_collection['item']: print(x.keys())
Out: dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'event', 'request', 'response']) the last dictionary doesn't have key 'item'
So is there any workaround/solution ? here's the structure of my postman collection:
And the final thing I'd like to mention is that I suppose it happens because this little guy /health - pass GET request. P.S. Can this library read the global environments variables from file?
This issue tracker is for Raspberry Pi wheels on piwheels.org, not general issues with a library. Please take your issue up with the maintainers. You may find their github or contact details through PyPI: https://pypi.org/project/postpy2/
Package name: example Link to PyPI page: https://pypi.org/project/postpy2/ Link to piwheels page: https://www.piwheels.org/project/postpy2/ Version: 0.0.6 Python version: 3.8 I am the maintainer: No More information: At using postpy2 library for working with postman, importing collection error during parsing. It simple try to get the key which does not exist. I tried to debug a little bit no success, everything is connected and I face keyerror on every step.
Please use code blocks where appropriate: def load(self): for fol in self.postman_collection['item']: requests_list = {} for request in fol['item']: if 'request' in request: request['request']['name'] = request['name'] requests_list[normalize_func_name( request['name'])] = PostRequest(self, request['request'])
I tried to run this code