Python Eve - REST API additional_lookup not working Python Eve - REST API additional_lookup not working flask flask

Python Eve - REST API additional_lookup not working


@Vorticity has the right fix. Just remove the leading "^" in your additional_lookup regex as follows:

'additional_lookup': {    'url': 'regex("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")',    'field': 'email'}

You should be able to retrieve your item with or without url encoding eg:

localhost:5000/user_creds/someemail@gmail.comlocalhost:5000/user_creds/someemail%40gmail.com

If you have any interest in making your items retrievable at the item level by email only (not object id), you can use item_lookup_field together with item_url:

'user_creds': {    ...    'item_url': 'regex("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")',    'item_lookup_field': 'email'}