Skip to main content

"API for your passwords."

Project description

https://travis-ci.org/toopy/mypasswords-api.svg?branch=master

API for your passwords.

Install

This python project requires python 3.6, otherwise the pip install should work fine:

$ pip install mypasswords-api

Usage

By default we can run the server as python module as follow:

$ mypasswords_api 127.0.0.1:8000
======== Running on http://127.0.0.1:8000 ========
(Press CTRL+C to quit)

It will start an aiohttp instance with the asyncio, or uvloop (if installed), event loop.

Settings

To handle settings we use simple-settings composition behavior. By default the base settings module will try to obtain values from the current environment:

$ MYPASSWORDS_PER_PAGE=100 PG_HOST=localhost mypasswords_api 127.0.0.1:8000

API

Create

$ http POST http://127.0.0.1:8000/passwords login=toopy password=abcd1234 site=github.com
HTTP/1.1 201 Created
Content-Length: 110
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2017 08:59:37 GMT
Server: Python/3.6 aiohttp/2.2.0
X-API-Version: 0.1.0.dev0

{
    "id": "0753c165-0400-4e1f-b79c-8998d4987daf",
    "login": "toopy",
    "password": "abcd1234",
    "site": "github.com"
}

Update

$ http PUT http://127.0.0.1:8000/passwords/0753c165-0400-4e1f-b79c-8998d4987daf login=toopy password=1234abcd site=github.com
HTTP/1.1 200 OK
Content-Length: 76
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2017 09:05:47 GMT
Server: Python/3.6 aiohttp/2.2.0
X-API-Version: 0.1.0.dev0

{
    "id": null,
    "login": "toopy",
    "password": "1234abcd",
    "site": "github.com"
}

List

$ http GET "http://127.0.0.1:8000/passwords?direction=desc&order_by=site&page1&per_page=2"
HTTP/1.1 200 OK
Content-Length: 212
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2017 09:23:43 GMT
Server: Python/3.6 aiohttp/2.2.0
X-API-Version: 0.1.0.dev0
X-Next-Link: /passwords?direction=desc&order_by=site&page=1&per_page=2

[
    {
        "id": "f4a59e0f-f1ff-4bc7-8757-203fc4b0aff7",
        "login": "toopy",
        "password": null,
        "site": "twitter.com"
    },
    {
        "id": "7ef3130f-7844-49c6-a46c-2f6960cae697",
        "login": "toopy",
        "password": null,
        "site": "slack.com"
    }
]

Get

$ http GET http://127.0.0.1:8000/passwords/7ef3130f-7844-49c6-a46c-2f6960cae697
HTTP/1.1 200 OK
Content-Length: 109
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2017 09:24:33 GMT
Server: Python/3.6 aiohttp/2.2.0
X-API-Version: 0.1.0.dev0

{
    "id": "7ef3130f-7844-49c6-a46c-2f6960cae697",
    "login": "toopy",
    "password": "1234abcd",
    "site": "slack.com"
}

Delete

$ http DELETE http://127.0.0.1:8000/passwords/7ef3130f-7844-49c6-a46c-2f6960cae697
HTTP/1.1 204 No Content
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2017 09:46:55 GMT
Server: Python/3.6 aiohttp/2.2.0
X-API-Version: 0.1.0.dev0

License

MIT License

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
mypasswords_api-0.4.0-py2.py3-none-any.whl (11.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3
mypasswords-api-0.4.0.tar.gz (9.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page