from holehe.core import *
from holehe.localuseragent import *


async def pinterest(email, client, out):
    name = "pinterest"
    try:
        req = await client.get(
            "https://www.pinterest.com/_ngjs/resource/EmailExistsResource/get/",
            params={
                "source_url": "/",
                "data": '{"options": {"email": "' + email + '"}, "context": {}}'})
        if req.json()["resource_response"]["data"]:
            out.append({"name": name,
                        "rateLimit": False,
                        "exists": True,
                        "emailrecovery": None,
                        "phoneNumber": None,
                        "others": None})
        else:
            out.append({"name": name,
                        "rateLimit": False,
                        "exists": False,
                        "emailrecovery": None,
                        "phoneNumber": None,
                        "others": None})
    except :
        out.append({"name": name,
                    "rateLimit": True,
                    "exists": False,
                    "emailrecovery": None,
                    "phoneNumber": None,
                    "others": None})
