contactlookup


Namecontactlookup JSON
Version 2.0.1 PyPI version JSON
download
home_pageNone
Summaryself-contained contacts API for searching through VCF for contact records
upload_time2024-10-13 07:39:45
maintainerNone
docs_urlNone
authorBryan Wodi
requires_python<4.0,>=3.10
licenseGNU GPL v3.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![buildstatus](https://github.com/talk2bryan/contactlookup/actions/workflows/ci.yml/badge.svg)](https://github.com/talk2bryan/contactlookup/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/talk2bryan/contactlookup/graph/badge.svg?token=IHS7IJ3RPN)](https://codecov.io/gh/talk2bryan/contactlookup)
[![PyPI version](https://badge.fury.io/py/contactlookup.svg)](https://badge.fury.io/py/contactlookup)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/contactlookup)](https://pypi.org/project/contactlookup/)
[![PyPI - License](https://img.shields.io/pypi/l/contactlookup)](https://pypi.org/project/contactlookup/)
[![PyPI - Format](https://img.shields.io/pypi/format/contactlookup)](https://pypi.org/project/contactlookup/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/contactlookup)](https://pypi.org/project/contactlookup/)

# contactlookup
Self hosted contacts API for searching through a VCF file for contact records

## Installation
Using pip:
```bash
pip install contactlookup
```
Using poetry:
```bash
poetry add contactlookup
```
Using pipenv:
```bash
pipenv install contactlookup
```

## Quick Start
### Running as a Docker container
Serve the contacts in the accompanying contacts.vcf file:
```bash
docker build -t contactlookup .
docker run -p 8000:8000 contactlookup # This uses the contacts.vcf file in the container
# Daemonize the container
docker run -d -p 8000:8000 contactlookup
```
If you want to use a different VCF file, you can mount it as a volume:
```bash
docker run -d -p 8000:8000 -v /path/to/contacts.vcf:/app/contacts.vcf contactlookup
```
:warning: The VCF file must be mounted at `/app/contacts.vcf` in the container.

To stop the container:
```bash
docker ps # Get the container ID
docker stop <container_id>
```

### Running as a CLI application
As a script:
```bash
contactlookup --help
contactlookup # Start the API server, and serve the contacts in the accompanying contacts.vcf file
contactlookup -f /path/to/contacts.vcf # Start the API server, and serve the contacts in the VCF file
```

As a module:
```bash
python -m contactlookup --help
```

### Using the API
You can search for contacts by
- first name,
- phone number, or
- email address.

The search is case-insensitive. _Partial matches are not yet supported_.
#### Search using web browser
Open your web browser and navigate to `http://localhost:8000/docs` to see the
API documentation. Depending on your setup, you may need to replace `localhost`.

### Search using curl
##### Search by email
```bash
curl -X 'GET' \
  'http://localhost:8000/contacts/email/jeffnewman@example.net' \
  -H 'accept: application/json'
```

##### Search by phone number
```bash
curl -X 'GET' \
  'http://localhost:8000/contacts/phone/+993-547-8840782' \
  -H 'accept: application/json'
```
The use of `+`, `-`, `.`, and `()` in the phone number is optional.
Response:
```json
{
    "contacts": [
        {
            "id": 1,
            "first_name": "KRISTEN",
            "last_name": "PEREZ",
            "other_names": null,
            "company": "Crescendo Associates",
            "title": null,
            "nickname": "NICKNAME",
            "birthday": "1966-08-19",
            "phone_numbers": [
                {
                    "id": null,
                    "number": "7194259182505",
                    "contact_id": 1,
                    "type": null
                },
                {
                    "id": null,
                    "number": "9935478840782",
                    "contact_id": 1,
                    "type": null
                }
            ],
            "addresses": [
                {
                    "id": null,
                    "street": "36346 Hall Stream",
                    "city": "CHRISTOPHERSTAD",
                    "state": "CA",
                    "postal_code": "73297",
                    "contact_id": 1,
                    "type": null,
                    "country": "USA"
                },
                {
                    "id": null,
                    "street": "196 Purple Sage Cres",
                    "city": "WINNIPEG",
                    "state": "MB",
                    "postal_code": "R3X 1V7",
                    "contact_id": 1,
                    "type": null,
                    "country": "CA"
                }
            ],
            "emails": [
                {
                    "id": null,
                    "email": "jacksonkimberly@example.net",
                    "type": null,
                    "contact_id": 1
                }
            ]
        }
    ]
}
```
##### Search by first name
```bash
curl -X 'GET' \
  'http://localhost:8000/contacts/fname/jeff' \
  -H 'accept: application/json'
```
Results are returned in JSON format:
```json
{
    "contacts": [
        {
            "id": 3,
            "first_name": "JEFF",
            "last_name": "",
            "other_names": null,
            "company": "Viagenie",
            "title": null,
            "nickname": null,
            "birthday": "1949-01-29",
            "phone_numbers": [
                {
                    "id": null,
                    "number": "3632144414254",
                    "contact_id": 3,
                    "type": null
                }
            ],
            "addresses": [
                {
                    "id": null,
                    "street": "2360 Bean Tunnel",
                    "city": "SOUTH JAMES",
                    "state": "DC",
                    "postal_code": "96916",
                    "contact_id": 3,
                    "type": null,
                    "country": "MONTSERRAT"
                },
                {
                    "id": null,
                    "street": "26767 Khan Dam",
                    "city": "EAST MARISAMOUTH",
                    "state": "MA",
                    "postal_code": "26701",
                    "contact_id": 3,
                    "type": null,
                    "country": "BRAZIL"
                },
                {
                    "id": null,
                    "street": "63932 Natasha Fords",
                    "city": "DEBRAVIEW",
                    "state": "VT",
                    "postal_code": "22957",
                    "contact_id": 3,
                    "type": null,
                    "country": "NAMIBIA"
                }
            ],
            "emails": [
                {
                    "id": null,
                    "email": "allentaylor@example.net",
                    "type": null,
                    "contact_id": 3
                },
                {
                    "id": null,
                    "email": "daniel03@example.net",
                    "type": null,
                    "contact_id": 3
                },
                {
                    "id": null,
                    "email": "martinezveronica@example.net",
                    "type": null,
                    "contact_id": 3
                }
            ]
        },
        {
            "id": 4,
            "first_name": "JEFF",
            "last_name": "NEWMAN",
            "other_names": null,
            "company": "Hollywood",
            "title": null,
            "nickname": null,
            "birthday": "1955-03-29",
            "phone_numbers": [
                {
                    "id": null,
                    "number": "161555531122",
                    "contact_id": 4,
                    "type": null
                }
            ],
            "addresses": [
                {
                    "id": null,
                    "street": "123 Hollywood St",
                    "city": "BEVERLEY-HILLS",
                    "state": "CA",
                    "postal_code": "22957",
                    "contact_id": 4,
                    "type": null,
                    "country": "USA"
                }
            ],
            "emails": [
                {
                    "id": null,
                    "email": "jeffnewman@example.net",
                    "type": null,
                    "contact_id": 4
                }
            ]
        }
    ]
}
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "contactlookup",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Bryan Wodi",
    "author_email": "pypi.envy443@dralias.com",
    "download_url": "https://files.pythonhosted.org/packages/3a/cd/fd51fef102feea8b093c68f511f663c30fd7813107ae003d9bdaf6ff08c0/contactlookup-2.0.1.tar.gz",
    "platform": null,
    "description": "[![buildstatus](https://github.com/talk2bryan/contactlookup/actions/workflows/ci.yml/badge.svg)](https://github.com/talk2bryan/contactlookup/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/talk2bryan/contactlookup/graph/badge.svg?token=IHS7IJ3RPN)](https://codecov.io/gh/talk2bryan/contactlookup)\n[![PyPI version](https://badge.fury.io/py/contactlookup.svg)](https://badge.fury.io/py/contactlookup)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/contactlookup)](https://pypi.org/project/contactlookup/)\n[![PyPI - License](https://img.shields.io/pypi/l/contactlookup)](https://pypi.org/project/contactlookup/)\n[![PyPI - Format](https://img.shields.io/pypi/format/contactlookup)](https://pypi.org/project/contactlookup/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/contactlookup)](https://pypi.org/project/contactlookup/)\n\n# contactlookup\nSelf hosted contacts API for searching through a VCF file for contact records\n\n## Installation\nUsing pip:\n```bash\npip install contactlookup\n```\nUsing poetry:\n```bash\npoetry add contactlookup\n```\nUsing pipenv:\n```bash\npipenv install contactlookup\n```\n\n## Quick Start\n### Running as a Docker container\nServe the contacts in the accompanying contacts.vcf file:\n```bash\ndocker build -t contactlookup .\ndocker run -p 8000:8000 contactlookup # This uses the contacts.vcf file in the container\n# Daemonize the container\ndocker run -d -p 8000:8000 contactlookup\n```\nIf you want to use a different VCF file, you can mount it as a volume:\n```bash\ndocker run -d -p 8000:8000 -v /path/to/contacts.vcf:/app/contacts.vcf contactlookup\n```\n:warning: The VCF file must be mounted at `/app/contacts.vcf` in the container.\n\nTo stop the container:\n```bash\ndocker ps # Get the container ID\ndocker stop <container_id>\n```\n\n### Running as a CLI application\nAs a script:\n```bash\ncontactlookup --help\ncontactlookup # Start the API server, and serve the contacts in the accompanying contacts.vcf file\ncontactlookup -f /path/to/contacts.vcf # Start the API server, and serve the contacts in the VCF file\n```\n\nAs a module:\n```bash\npython -m contactlookup --help\n```\n\n### Using the API\nYou can search for contacts by\n- first name,\n- phone number, or\n- email address.\n\nThe search is case-insensitive. _Partial matches are not yet supported_.\n#### Search using web browser\nOpen your web browser and navigate to `http://localhost:8000/docs` to see the\nAPI documentation. Depending on your setup, you may need to replace `localhost`.\n\n### Search using curl\n##### Search by email\n```bash\ncurl -X 'GET' \\\n  'http://localhost:8000/contacts/email/jeffnewman@example.net' \\\n  -H 'accept: application/json'\n```\n\n##### Search by phone number\n```bash\ncurl -X 'GET' \\\n  'http://localhost:8000/contacts/phone/+993-547-8840782' \\\n  -H 'accept: application/json'\n```\nThe use of `+`, `-`, `.`, and `()` in the phone number is optional.\nResponse:\n```json\n{\n    \"contacts\": [\n        {\n            \"id\": 1,\n            \"first_name\": \"KRISTEN\",\n            \"last_name\": \"PEREZ\",\n            \"other_names\": null,\n            \"company\": \"Crescendo Associates\",\n            \"title\": null,\n            \"nickname\": \"NICKNAME\",\n            \"birthday\": \"1966-08-19\",\n            \"phone_numbers\": [\n                {\n                    \"id\": null,\n                    \"number\": \"7194259182505\",\n                    \"contact_id\": 1,\n                    \"type\": null\n                },\n                {\n                    \"id\": null,\n                    \"number\": \"9935478840782\",\n                    \"contact_id\": 1,\n                    \"type\": null\n                }\n            ],\n            \"addresses\": [\n                {\n                    \"id\": null,\n                    \"street\": \"36346 Hall Stream\",\n                    \"city\": \"CHRISTOPHERSTAD\",\n                    \"state\": \"CA\",\n                    \"postal_code\": \"73297\",\n                    \"contact_id\": 1,\n                    \"type\": null,\n                    \"country\": \"USA\"\n                },\n                {\n                    \"id\": null,\n                    \"street\": \"196 Purple Sage Cres\",\n                    \"city\": \"WINNIPEG\",\n                    \"state\": \"MB\",\n                    \"postal_code\": \"R3X 1V7\",\n                    \"contact_id\": 1,\n                    \"type\": null,\n                    \"country\": \"CA\"\n                }\n            ],\n            \"emails\": [\n                {\n                    \"id\": null,\n                    \"email\": \"jacksonkimberly@example.net\",\n                    \"type\": null,\n                    \"contact_id\": 1\n                }\n            ]\n        }\n    ]\n}\n```\n##### Search by first name\n```bash\ncurl -X 'GET' \\\n  'http://localhost:8000/contacts/fname/jeff' \\\n  -H 'accept: application/json'\n```\nResults are returned in JSON format:\n```json\n{\n    \"contacts\": [\n        {\n            \"id\": 3,\n            \"first_name\": \"JEFF\",\n            \"last_name\": \"\",\n            \"other_names\": null,\n            \"company\": \"Viagenie\",\n            \"title\": null,\n            \"nickname\": null,\n            \"birthday\": \"1949-01-29\",\n            \"phone_numbers\": [\n                {\n                    \"id\": null,\n                    \"number\": \"3632144414254\",\n                    \"contact_id\": 3,\n                    \"type\": null\n                }\n            ],\n            \"addresses\": [\n                {\n                    \"id\": null,\n                    \"street\": \"2360 Bean Tunnel\",\n                    \"city\": \"SOUTH JAMES\",\n                    \"state\": \"DC\",\n                    \"postal_code\": \"96916\",\n                    \"contact_id\": 3,\n                    \"type\": null,\n                    \"country\": \"MONTSERRAT\"\n                },\n                {\n                    \"id\": null,\n                    \"street\": \"26767 Khan Dam\",\n                    \"city\": \"EAST MARISAMOUTH\",\n                    \"state\": \"MA\",\n                    \"postal_code\": \"26701\",\n                    \"contact_id\": 3,\n                    \"type\": null,\n                    \"country\": \"BRAZIL\"\n                },\n                {\n                    \"id\": null,\n                    \"street\": \"63932 Natasha Fords\",\n                    \"city\": \"DEBRAVIEW\",\n                    \"state\": \"VT\",\n                    \"postal_code\": \"22957\",\n                    \"contact_id\": 3,\n                    \"type\": null,\n                    \"country\": \"NAMIBIA\"\n                }\n            ],\n            \"emails\": [\n                {\n                    \"id\": null,\n                    \"email\": \"allentaylor@example.net\",\n                    \"type\": null,\n                    \"contact_id\": 3\n                },\n                {\n                    \"id\": null,\n                    \"email\": \"daniel03@example.net\",\n                    \"type\": null,\n                    \"contact_id\": 3\n                },\n                {\n                    \"id\": null,\n                    \"email\": \"martinezveronica@example.net\",\n                    \"type\": null,\n                    \"contact_id\": 3\n                }\n            ]\n        },\n        {\n            \"id\": 4,\n            \"first_name\": \"JEFF\",\n            \"last_name\": \"NEWMAN\",\n            \"other_names\": null,\n            \"company\": \"Hollywood\",\n            \"title\": null,\n            \"nickname\": null,\n            \"birthday\": \"1955-03-29\",\n            \"phone_numbers\": [\n                {\n                    \"id\": null,\n                    \"number\": \"161555531122\",\n                    \"contact_id\": 4,\n                    \"type\": null\n                }\n            ],\n            \"addresses\": [\n                {\n                    \"id\": null,\n                    \"street\": \"123 Hollywood St\",\n                    \"city\": \"BEVERLEY-HILLS\",\n                    \"state\": \"CA\",\n                    \"postal_code\": \"22957\",\n                    \"contact_id\": 4,\n                    \"type\": null,\n                    \"country\": \"USA\"\n                }\n            ],\n            \"emails\": [\n                {\n                    \"id\": null,\n                    \"email\": \"jeffnewman@example.net\",\n                    \"type\": null,\n                    \"contact_id\": 4\n                }\n            ]\n        }\n    ]\n}\n```\n\n",
    "bugtrack_url": null,
    "license": "GNU GPL v3.0",
    "summary": "self-contained contacts API for searching through VCF for contact records",
    "version": "2.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/talk2bryan/contactlookup/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38e0a7a5d2e96bdad32da9c15f0a65c3ecd4db4ea6d0f0fe566b89c33e3f4fff",
                "md5": "83f306e57d191b61eaf64844bb0add30",
                "sha256": "55e8f74a04a9ed36980b968a5e0ef82c40829ef3bf7e07bb64bf81acaa8c8036"
            },
            "downloads": -1,
            "filename": "contactlookup-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83f306e57d191b61eaf64844bb0add30",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 27718,
            "upload_time": "2024-10-13T07:39:43",
            "upload_time_iso_8601": "2024-10-13T07:39:43.805820Z",
            "url": "https://files.pythonhosted.org/packages/38/e0/a7a5d2e96bdad32da9c15f0a65c3ecd4db4ea6d0f0fe566b89c33e3f4fff/contactlookup-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3acdfd51fef102feea8b093c68f511f663c30fd7813107ae003d9bdaf6ff08c0",
                "md5": "09158b09ca344690df0fa1131703a8fa",
                "sha256": "f388e41786dc3947ea561fb1efc7e754a126099e938e404a04e1b99a097b9d79"
            },
            "downloads": -1,
            "filename": "contactlookup-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "09158b09ca344690df0fa1131703a8fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 28639,
            "upload_time": "2024-10-13T07:39:45",
            "upload_time_iso_8601": "2024-10-13T07:39:45.164559Z",
            "url": "https://files.pythonhosted.org/packages/3a/cd/fd51fef102feea8b093c68f511f663c30fd7813107ae003d9bdaf6ff08c0/contactlookup-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 07:39:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "talk2bryan",
    "github_project": "contactlookup",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "contactlookup"
}
        
Elapsed time: 0.44447s