Skip to main content

self-contained contacts API for searching through VCF for contact records

Project description

buildstatus codecov PyPI version PyPI - Python Version PyPI - License PyPI - Format PyPI - Wheel

contactlookup

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

Installation

Using pip:

pip install contactlookup

Using poetry:

poetry add contactlookup

Using pipenv:

pipenv install contactlookup

Quick Start

As a script:

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:

python -m contactlookup --help

Examples

Start and stop the API server

contactlookup -f /path/to/contacts.vcf # API is now running

Kill the server with Ctrl+C

Search for contacts

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.

Search using curl

Search by email
curl -X 'GET' \
  'http://localhost:8000/contacts/email/jeffnewman@example.net' \
  -H 'accept: application/json'
Search by phone number
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:

{
    "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
curl -X 'GET' \
  'http://localhost:8000/contacts/fname/jeff' \
  -H 'accept: application/json'

Results are returned in JSON format:

{
    "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
                }
            ]
        }
    ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contactlookup-1.0.2.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

contactlookup-1.0.2-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file contactlookup-1.0.2.tar.gz.

File metadata

  • Download URL: contactlookup-1.0.2.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for contactlookup-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d3bf052530dd91ec2fac31e5f81d34d8cfa7e61e20e35d5e1d0c639481027c75
MD5 c6cd53fdfe816f226bc7f39095197e4b
BLAKE2b-256 caf166e0555dda511c38f09e9c0b8082cfa8bb7d24ee8a4401508996fe455c97

See more details on using hashes here.

File details

Details for the file contactlookup-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contactlookup-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 33c5d2b1562fa6807fdbd96ffdbbd7beb9f8312ff0317dc6a51e396b110647e9
MD5 1500eef1a7c903b442a2e7d1a7b30f6d
BLAKE2b-256 655dcfea6d1fd339f1027db5fad32e927dbe860d42e8095094f8671d0a0f5f62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page