Coder Social home page Coder Social logo

addressbook's Introduction

Address Book storage library

The assignment is to implement a simple address book library in Python. Read here about requirements

Note: it stores all the data in memory, for future usage it should be extended with DB/File based storage. In real production case I would use Django Rest Framework and queries to the database to achieve this functionality.

See answer to design question below

Find person by email address (can supply any substring, ie. "comp" should work assuming "[email protected]" is an email address in the address book) - discuss how you would implement this without coding the solution.

I would use following check if 'comp' in "[email protected]" while looking for relevant objects using Python. In case of database storage email should be indexed column and I will use query LIKE '%'.

Basic Usage. API calls examples.

Requirements

  • Python 2.7

Installation

mkdir testapp
cd testapp
virtualenv env
source env/bin/activate

git clone [email protected]:yrik/addressbook.git
cd addressbook
python setup.py test
pip install .
cd ..
python
from addressbook import AddressBook

API call examples.

from addressbook import AddressBook

address_book = AddressBook()


# Add a person to the address book
john_dict = {
    'first_name': 'John',
    'last_name': 'Deer',
    'email_list': ['[email protected]'],
    'phone_list': ['999-999-9999'],
    'address_list': ['Anthony Benoit 490 E, Main Street Norwich, CT 06360, US'],
    'group_list': ['general'],
}

address_book.add_person(john_dict)

# Add a group to address book
address_book.add_group("friends")

# Find group members
address_book.find_persons(group='general')

# Find person using first_name only
address_book.find_persons(first_name='John')

# Find person using first_name and last_name
address_book.find_persons(first_name='John', last_name='Deer')

# Find person using email
address_book.find_persons(email='[email protected]')

# Find person using email prefix
address_book.find_persons(email='john')

addressbook's People

Contributors

yrik avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.