def buildImage(response, action, outputs): if hasattr(action, "image"): if response is not None: #try: imagebytes = response.content outputs[action.image] = imagebytes #except AttributeError: else: print("No response received"), return outputs