diff --git a/Hunter.io/Hunter.io_Find_email.ipynb b/Hunter.io/Hunter.io_Find_email.ipynb new file mode 100644 index 0000000000..bff2ee3fcf --- /dev/null +++ b/Hunter.io/Hunter.io_Find_email.ipynb @@ -0,0 +1,331 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "84cadd0c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "\"GitHub.png\"" + ] + }, + { + "cell_type": "markdown", + "id": "0d43ed38", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "# Hunter.io - Find email\n", + "Give Feedback | Bug report" + ] + }, + { + "cell_type": "markdown", + "id": "d9313642", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Tags:** #github #email #find #automation #snippet" + ] + }, + { + "cell_type": "markdown", + "id": "8faf487c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Author:** [Varsha Kumar](https://www.linkedin.com/in/varsha-kumar-590466305/)" + ] + }, + { + "cell_type": "markdown", + "id": "3dba1c73-548d-4008-82ad-fdb2cb376771", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Last update:** 2024-06-26 (Created: 2024-06-25)" + ] + }, + { + "cell_type": "markdown", + "id": "naas-description", + "metadata": { + "papermill": {}, + "tags": [ + "description" + ] + }, + "source": [ + "**Description:** This notebook allows users to find an email through hunter.io." + ] + }, + { + "cell_type": "markdown", + "id": "7412988b", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Input" + ] + }, + { + "cell_type": "markdown", + "id": "b483a140", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "353ef79c", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:51:07.687424Z", + "iopub.status.busy": "2024-06-26T06:51:07.686982Z", + "iopub.status.idle": "2024-06-26T06:51:07.820922Z", + "shell.execute_reply": "2024-06-26T06:51:07.820320Z", + "shell.execute_reply.started": "2024-06-26T06:51:07.687346Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "import requests\n", + "import pickle" + ] + }, + { + "cell_type": "markdown", + "id": "68b48858", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Setup variables" + ] + }, + { + "cell_type": "markdown", + "id": "b69f38ae-a69c-4360-8cf9-099cda04f098", + "metadata": {}, + "source": [ + "- `domain_name`: company name\n", + "- `api_key`: token to get data through hunter.io" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "01647a55", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:51:07.823964Z", + "iopub.status.busy": "2024-06-26T06:51:07.823776Z", + "iopub.status.idle": "2024-06-26T06:51:07.845207Z", + "shell.execute_reply": "2024-06-26T06:51:07.844693Z", + "shell.execute_reply.started": "2024-06-26T06:51:07.823942Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "domain_name = \"naas.ai\"\n", + "api_key = \"899fa50c3a6c56e8b19e37608140f327bf9xxxxx\"" + ] + }, + { + "cell_type": "markdown", + "id": "93347abb", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Model\n" + ] + }, + { + "cell_type": "markdown", + "id": "ebfad846-2a68-4855-909c-1b2a9a7bcfa5", + "metadata": {}, + "source": [ + "### Save to pickle" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "187ace2f-4049-4e55-b856-a955add1bfd4", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:51:07.847589Z", + "iopub.status.busy": "2024-06-26T06:51:07.847422Z", + "iopub.status.idle": "2024-06-26T06:51:07.941121Z", + "shell.execute_reply": "2024-06-26T06:51:07.940546Z", + "shell.execute_reply.started": "2024-06-26T06:51:07.847571Z" + } + }, + "outputs": [], + "source": [ + "def save_to_pickle(data, filename):\n", + " with open(filename, 'wb') as file:\n", + " pickle.dump(data, file)\n", + " print(f\"Data saved to {filename}\")" + ] + }, + { + "cell_type": "markdown", + "id": "7537ee02-afad-4d87-8883-afae67365f46", + "metadata": {}, + "source": [ + "### Find emails" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "bb42b49d-b53e-4255-8a59-c824cd49aeac", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:52:03.944977Z", + "iopub.status.busy": "2024-06-26T06:52:03.944753Z", + "iopub.status.idle": "2024-06-26T06:52:03.951063Z", + "shell.execute_reply": "2024-06-26T06:52:03.950533Z", + "shell.execute_reply.started": "2024-06-26T06:52:03.944954Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "def domain_search(domain, api_key):\n", + " url = f\"https://api.hunter.io/v2/domain-search?domain={domain}&api_key={api_key}\"\n", + " response = requests.get(url)\n", + " \n", + " if response.status_code == 200:\n", + " data = response.json()\n", + " emails = []\n", + "\n", + " # Extract emails from the response\n", + " if 'data' in data:\n", + " for email in data['data']['emails']:\n", + " emails.append(email['value'])\n", + " \n", + " # Save emails to pickle file\n", + " save_to_pickle(emails, f\"{domain}_emails.pickle\")\n", + " return emails\n", + " else:\n", + " return {\"error\": \"No data found\"}\n", + " else:\n", + " return {\"error\": f\"Error {response.status_code}: {response.json().get('errors', 'Unknown error')}\"}" + ] + }, + { + "cell_type": "markdown", + "id": "b819d06a", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Output\n" + ] + }, + { + "cell_type": "markdown", + "id": "8b6ecf57-fec4-4e72-a7b8-4985bca76c05", + "metadata": {}, + "source": [ + "### Display result" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5182d09a-e6d7-4d9d-9f38-eb3a9ce87cf1", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:52:05.312000Z", + "iopub.status.busy": "2024-06-26T06:52:05.311776Z", + "iopub.status.idle": "2024-06-26T06:52:05.442030Z", + "shell.execute_reply": "2024-06-26T06:52:05.441430Z", + "shell.execute_reply.started": "2024-06-26T06:52:05.311977Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Data saved to naas.ai_emails.pickle\n" + ] + }, + { + "data": { + "text/plain": [ + "['jeremy@naas.ai', 'abi@naas.ai', 'support@naas.ai']" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "domain_search_result = domain_search(domain_name, api_key)\n", + "domain_search_result" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + }, + "naas": { + "notebook_id": "b8a92a0e4b6e40db304564f999566443fb35e93df716ab4be5021aabba8230ee", + "notebook_path": "GitHub/GitHub_Add_new_issues_as_page_in_Notion_database.ipynb" + }, + "papermill": { + "default_parameters": {}, + "environment_variables": {}, + "parameters": {}, + "version": "2.3.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Hunter.io/Hunter.io_Search_domain.ipynb b/Hunter.io/Hunter.io_Search_domain.ipynb new file mode 100644 index 0000000000..82b6252f8f --- /dev/null +++ b/Hunter.io/Hunter.io_Search_domain.ipynb @@ -0,0 +1,556 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "84cadd0c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "\"GitHub.png\"" + ] + }, + { + "cell_type": "markdown", + "id": "0d43ed38", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "# Hunter.io - Search domain\n", + "Give Feedback | Bug report" + ] + }, + { + "cell_type": "markdown", + "id": "d9313642", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Tags:** #github #organization #automation #snippet" + ] + }, + { + "cell_type": "markdown", + "id": "8faf487c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Author:** [Varsha Kumar](https://www.linkedin.com/in/varsha-kumar-590466305/)" + ] + }, + { + "cell_type": "markdown", + "id": "3dba1c73-548d-4008-82ad-fdb2cb376771", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Last update:** 2024-06-26 (Created: 2024-06-25)" + ] + }, + { + "cell_type": "markdown", + "id": "naas-description", + "metadata": { + "papermill": {}, + "tags": [ + "description" + ] + }, + "source": [ + "**Description:** This notebook allows users to retrieve organization data from a repository through hunter.io." + ] + }, + { + "cell_type": "markdown", + "id": "7412988b", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Input" + ] + }, + { + "cell_type": "markdown", + "id": "b483a140", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "353ef79c", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:09.928745Z", + "iopub.status.busy": "2024-06-27T06:37:09.928368Z", + "iopub.status.idle": "2024-06-27T06:37:10.121417Z", + "shell.execute_reply": "2024-06-27T06:37:10.120425Z", + "shell.execute_reply.started": "2024-06-27T06:37:09.928673Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "import requests\n", + "import pickle" + ] + }, + { + "cell_type": "markdown", + "id": "f2781aef-1c8d-4b6b-89bf-bb1a7513619b", + "metadata": {}, + "source": [ + "### How to get api key" + ] + }, + { + "cell_type": "markdown", + "id": "1492a5db-0c16-4f86-bf04-e0fa76e87f16", + "metadata": {}, + "source": [ + "1. Create and account with hunter.io (free plan).\n", + "2. Go to account and settings or look up \"https://hunter.io/api-keys\".\n", + "3. Under the tab \"API\" an exisiting key should be there. If not, click \"New key\" and create one.\n", + "4. Copy your key and use it to retrieve anything" + ] + }, + { + "cell_type": "markdown", + "id": "68b48858", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Setup variables" + ] + }, + { + "cell_type": "markdown", + "id": "b69f38ae-a69c-4360-8cf9-099cda04f098", + "metadata": {}, + "source": [ + "- `domain_name`: name of the company\n", + "- `api_key`: token to get data through hunter.io\n", + "- `file_path`: name of pickle file" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "01647a55", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:10.123635Z", + "iopub.status.busy": "2024-06-27T06:37:10.123259Z", + "iopub.status.idle": "2024-06-27T06:37:10.126869Z", + "shell.execute_reply": "2024-06-27T06:37:10.126313Z", + "shell.execute_reply.started": "2024-06-27T06:37:10.123603Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "domain_name = \"naas.ai\"\n", + "api_key = \"899fa50c3a6c56e8b19e37608140f327bf9xxxxx\"\n", + "file_path = f\"{domain_name}_domain.pickle\"" + ] + }, + { + "cell_type": "markdown", + "id": "93347abb", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Model\n" + ] + }, + { + "cell_type": "markdown", + "id": "9baade14-7bdf-40bb-98f5-b818420dece3", + "metadata": {}, + "source": [ + "### Save to pickle" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "c6043f13-3b5a-4427-9637-99ea83e71f97", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:10.128230Z", + "iopub.status.busy": "2024-06-27T06:37:10.127861Z", + "iopub.status.idle": "2024-06-27T06:37:10.221005Z", + "shell.execute_reply": "2024-06-27T06:37:10.220407Z", + "shell.execute_reply.started": "2024-06-27T06:37:10.128199Z" + } + }, + "outputs": [], + "source": [ + "def save_to_pickle(data, filename):\n", + " with open(filename, 'wb') as file:\n", + " pickle.dump(data, file)" + ] + }, + { + "cell_type": "markdown", + "id": "a92d9ac3-b6a8-44c3-a715-614be57bed88", + "metadata": {}, + "source": [ + "### Check if data already exists" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "fff67afd-c575-4b6f-9206-eeda3c4c5bd4", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:10.222225Z", + "iopub.status.busy": "2024-06-27T06:37:10.221978Z", + "iopub.status.idle": "2024-06-27T06:37:10.322474Z", + "shell.execute_reply": "2024-06-27T06:37:10.321744Z", + "shell.execute_reply.started": "2024-06-27T06:37:10.222196Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "File not found\n" + ] + } + ], + "source": [ + "data = None\n", + "try:\n", + " with open(file_path, 'rb') as file:\n", + " data = pickle.load(file)\n", + " print(\"Data loaded successfully\")\n", + "except FileNotFoundError:\n", + " print(\"File not found\")\n", + "except pickle.UnpicklingError:\n", + " print(\"Error unpickling the file\")\n", + "except Exception as e:\n", + " print(f\"An error occurred: {e}\")" + ] + }, + { + "cell_type": "markdown", + "id": "7537ee02-afad-4d87-8883-afae67365f46", + "metadata": {}, + "source": [ + "### Get company details" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "bb42b49d-b53e-4255-8a59-c824cd49aeac", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:10.323884Z", + "iopub.status.busy": "2024-06-27T06:37:10.323451Z", + "iopub.status.idle": "2024-06-27T06:37:10.566877Z", + "shell.execute_reply": "2024-06-27T06:37:10.566140Z", + "shell.execute_reply.started": "2024-06-27T06:37:10.323852Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Data has been saved to naas.ai_domain.pickle\n" + ] + } + ], + "source": [ + "def get_company_details(domain, api_key):\n", + " # Hunter.io API endpoint for company information\n", + " url = f\"https://api.hunter.io/v2/domain-search?domain={domain}&api_key={api_key}\"\n", + " \n", + " # Send GET request to the Hunter.io API\n", + " response = requests.get(url)\n", + " \n", + " # Check if the request was successful\n", + " if response.status_code == 200:\n", + " data = response.json()\n", + " if 'data' in data:\n", + " return data['data']\n", + " else:\n", + " return \"Company details not found\"\n", + " else:\n", + " return f\"Error: {response.status_code} - {response.json().get('errors', 'Unknown error')}\"\n", + "\n", + "if data is None:\n", + " data = get_company_details(domain_name, api_key)\n", + " # Writing data to a pickle file\n", + " try:\n", + " save_to_pickle(data, file_path)\n", + " print(f\"Data has been saved to {file_path}\")\n", + " except Exception as e:\n", + " print(f\"An error occurred while saving the data: {e}\")" + ] + }, + { + "cell_type": "markdown", + "id": "b819d06a", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Output\n" + ] + }, + { + "cell_type": "markdown", + "id": "8b6ecf57-fec4-4e72-a7b8-4985bca76c05", + "metadata": {}, + "source": [ + "### Display result" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "5182d09a-e6d7-4d9d-9f38-eb3a9ce87cf1", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-27T06:37:10.569366Z", + "iopub.status.busy": "2024-06-27T06:37:10.569188Z", + "iopub.status.idle": "2024-06-27T06:37:10.583821Z", + "shell.execute_reply": "2024-06-27T06:37:10.582919Z", + "shell.execute_reply.started": "2024-06-27T06:37:10.569345Z" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'domain': 'naas.ai',\n", + " 'disposable': False,\n", + " 'webmail': False,\n", + " 'accept_all': False,\n", + " 'pattern': '{first}',\n", + " 'organization': 'Naas.ai',\n", + " 'description': 'Naas.ai is a data science platform that allows users to schedule, run, and expose data projects using Jupyter notebooks.',\n", + " 'industry': 'Software Development',\n", + " 'twitter': 'https://twitter.com/jupyternaas',\n", + " 'facebook': None,\n", + " 'linkedin': 'https://linkedin.com/company/naas-ai',\n", + " 'instagram': None,\n", + " 'youtube': None,\n", + " 'technologies': ['express',\n", + " 'google-analytics',\n", + " 'google-tag-manager',\n", + " 'node-js',\n", + " 'stripe',\n", + " 'youtube'],\n", + " 'country': 'FR',\n", + " 'state': None,\n", + " 'city': 'Paris',\n", + " 'postal_code': None,\n", + " 'street': None,\n", + " 'headcount': '1-10',\n", + " 'company_type': 'privately held',\n", + " 'emails': [{'value': 'jeremy@naas.ai',\n", + " 'type': 'personal',\n", + " 'confidence': 99,\n", + " 'sources': [{'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/policies/privacy',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/resources/community/code-of-conduct',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/policies/privacy',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/solutions/introduction',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/templates/formant/formant_query_device_network',\n", + " 'extracted_on': '2023-09-06',\n", + " 'last_seen_on': '2023-12-06',\n", + " 'still_on_page': False},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/templates/notion/notion_update_page',\n", + " 'extracted_on': '2023-06-06',\n", + " 'last_seen_on': '2023-12-06',\n", + " 'still_on_page': False},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/templates/notion/notion_update_pages_from_database',\n", + " 'extracted_on': '2023-06-06',\n", + " 'last_seen_on': '2023-12-06',\n", + " 'still_on_page': False}],\n", + " 'first_name': None,\n", + " 'last_name': None,\n", + " 'position': None,\n", + " 'seniority': None,\n", + " 'department': None,\n", + " 'linkedin': None,\n", + " 'twitter': None,\n", + " 'phone_number': None,\n", + " 'verification': {'date': None, 'status': None}},\n", + " {'value': 'abi@naas.ai',\n", + " 'type': 'personal',\n", + " 'confidence': 86,\n", + " 'sources': [{'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/resources/developers/overview',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/developers/overview',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False}],\n", + " 'first_name': None,\n", + " 'last_name': None,\n", + " 'position': None,\n", + " 'seniority': None,\n", + " 'department': None,\n", + " 'linkedin': None,\n", + " 'twitter': None,\n", + " 'phone_number': None,\n", + " 'verification': {'date': None, 'status': None}},\n", + " {'value': 'support@naas.ai',\n", + " 'type': 'generic',\n", + " 'confidence': 84,\n", + " 'sources': [{'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/mission/unlocking-monetization-opportunities',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/resources/developers/overview',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/safety/product-warnings',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'docs.naas.ai',\n", + " 'uri': 'http://docs.naas.ai/usage/aia-personal-ai-assistant',\n", + " 'extracted_on': '2024-05-16',\n", + " 'last_seen_on': '2024-05-16',\n", + " 'still_on_page': True},\n", + " {'domain': 'github.com',\n", + " 'uri': 'http://github.com/jupyter-naas/awesome-notebooks',\n", + " 'extracted_on': '2023-10-07',\n", + " 'last_seen_on': '2023-10-07',\n", + " 'still_on_page': True},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/developers/overview',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/platform/scalable-computing',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False},\n", + " {'domain': 'site.naas.ai',\n", + " 'uri': 'http://site.naas.ai/docs/platform/security-suite',\n", + " 'extracted_on': '2024-02-26',\n", + " 'last_seen_on': '2024-02-26',\n", + " 'still_on_page': False}],\n", + " 'first_name': None,\n", + " 'last_name': None,\n", + " 'position': None,\n", + " 'seniority': None,\n", + " 'department': 'support',\n", + " 'linkedin': None,\n", + " 'twitter': None,\n", + " 'phone_number': None,\n", + " 'verification': {'date': None, 'status': None}}],\n", + " 'linked_domains': []}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0818cf8-436a-45e4-b35b-9677333d047a", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + }, + "naas": { + "notebook_id": "b8a92a0e4b6e40db304564f999566443fb35e93df716ab4be5021aabba8230ee", + "notebook_path": "GitHub/GitHub_Add_new_issues_as_page_in_Notion_database.ipynb" + }, + "papermill": { + "default_parameters": {}, + "environment_variables": {}, + "parameters": {}, + "version": "2.3.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Hunter.io/Hunter.io_Verify_email.ipynb b/Hunter.io/Hunter.io_Verify_email.ipynb new file mode 100644 index 0000000000..79df919c44 --- /dev/null +++ b/Hunter.io/Hunter.io_Verify_email.ipynb @@ -0,0 +1,327 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "84cadd0c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "\"GitHub.png\"" + ] + }, + { + "cell_type": "markdown", + "id": "0d43ed38", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "# Hunter.io - Verify email\n", + "Give Feedback | Bug report" + ] + }, + { + "cell_type": "markdown", + "id": "d9313642", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Tags:** #github #email #verification #automation #snippet" + ] + }, + { + "cell_type": "markdown", + "id": "8faf487c", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Author:** [Varsha Kumar](https://www.linkedin.com/in/varsha-kumar-590466305/)" + ] + }, + { + "cell_type": "markdown", + "id": "3dba1c73-548d-4008-82ad-fdb2cb376771", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "**Last update:** 2024-06-26 (Created: 2024-06-25)" + ] + }, + { + "cell_type": "markdown", + "id": "naas-description", + "metadata": { + "papermill": {}, + "tags": [ + "description" + ] + }, + "source": [ + "**Description:** This notebook allows users to verify an email through hunter.io." + ] + }, + { + "cell_type": "markdown", + "id": "7412988b", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Input" + ] + }, + { + "cell_type": "markdown", + "id": "b483a140", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "353ef79c", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:26:45.089534Z", + "iopub.status.busy": "2024-06-26T06:26:45.089075Z", + "iopub.status.idle": "2024-06-26T06:26:47.672815Z", + "shell.execute_reply": "2024-06-26T06:26:47.672198Z", + "shell.execute_reply.started": "2024-06-26T06:26:45.089462Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "import requests\n", + "import pickle" + ] + }, + { + "cell_type": "markdown", + "id": "68b48858", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "### Setup variables" + ] + }, + { + "cell_type": "markdown", + "id": "b69f38ae-a69c-4360-8cf9-099cda04f098", + "metadata": {}, + "source": [ + "- `email`: email for verification\n", + "- `api_key`: token to get data through hunter.io\n", + "- `file_path`: name of pickle file" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "01647a55", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:26:47.674042Z", + "iopub.status.busy": "2024-06-26T06:26:47.673804Z", + "iopub.status.idle": "2024-06-26T06:26:47.678728Z", + "shell.execute_reply": "2024-06-26T06:26:47.678182Z", + "shell.execute_reply.started": "2024-06-26T06:26:47.674015Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [], + "source": [ + "email = \"florent@naas.ai\"\n", + "api_key = \"899fa50c3a6c56e8b19e37608140f327bf9xxxxx\"\n", + "file_path = \"verification_result.pickle\"" + ] + }, + { + "cell_type": "markdown", + "id": "93347abb", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Model\n" + ] + }, + { + "cell_type": "markdown", + "id": "7537ee02-afad-4d87-8883-afae67365f46", + "metadata": {}, + "source": [ + "### Verify email" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "bb42b49d-b53e-4255-8a59-c824cd49aeac", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:26:47.680893Z", + "iopub.status.busy": "2024-06-26T06:26:47.680699Z", + "iopub.status.idle": "2024-06-26T06:26:47.774581Z", + "shell.execute_reply": "2024-06-26T06:26:47.773759Z", + "shell.execute_reply.started": "2024-06-26T06:26:47.680873Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "def verify_email_with_hunter(api_key, email):\n", + " url = f\"https://api.hunter.io/v2/email-verifier\"\n", + " params = {\n", + " 'email': email,\n", + " 'api_key': api_key\n", + " }\n", + " response = requests.get(url, params=params)\n", + " \n", + " if response.status_code == 200:\n", + " return response.json()\n", + " else:\n", + " return f\"Error: {response.status_code} - {response.json().get('errors', 'Unknown error')}\"\n", + "\n", + "# Verify the email\n", + "verification_result = verify_email_with_hunter(email, api_key)" + ] + }, + { + "cell_type": "markdown", + "id": "b96cc59e-714e-426f-8630-df99b5454326", + "metadata": {}, + "source": [ + "### Save to pickle" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "5878561a-ded9-4caf-a6f9-53a1cb76b352", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:26:47.776305Z", + "iopub.status.busy": "2024-06-26T06:26:47.775802Z", + "iopub.status.idle": "2024-06-26T06:26:47.875107Z", + "shell.execute_reply": "2024-06-26T06:26:47.874530Z", + "shell.execute_reply.started": "2024-06-26T06:26:47.776270Z" + } + }, + "outputs": [], + "source": [ + "def save_to_pickle(data, filename):\n", + " with open(filename, 'wb') as file:\n", + " pickle.dump(data, file)" + ] + }, + { + "cell_type": "markdown", + "id": "b819d06a", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Output\n" + ] + }, + { + "cell_type": "markdown", + "id": "8b6ecf57-fec4-4e72-a7b8-4985bca76c05", + "metadata": {}, + "source": [ + "### Display result" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "5182d09a-e6d7-4d9d-9f38-eb3a9ce87cf1", + "metadata": { + "execution": { + "iopub.execute_input": "2024-06-26T06:26:47.877696Z", + "iopub.status.busy": "2024-06-26T06:26:47.877520Z", + "iopub.status.idle": "2024-06-26T06:26:48.049499Z", + "shell.execute_reply": "2024-06-26T06:26:48.048853Z", + "shell.execute_reply.started": "2024-06-26T06:26:47.877677Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Verification result has been saved to verification_result.pickle\n" + ] + } + ], + "source": [ + "# Save the result to a pickle file\n", + "save_to_pickle(verification_result, file_path)\n", + "\n", + "print(f\"Verification result has been saved to {file_path}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0818cf8-436a-45e4-b35b-9677333d047a", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + }, + "naas": { + "notebook_id": "b8a92a0e4b6e40db304564f999566443fb35e93df716ab4be5021aabba8230ee", + "notebook_path": "GitHub/GitHub_Add_new_issues_as_page_in_Notion_database.ipynb" + }, + "papermill": { + "default_parameters": {}, + "environment_variables": {}, + "parameters": {}, + "version": "2.3.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}