{ "info": { "author": "left-join", "author_email": "left-join@riseup.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# flask-restive-identifiers\nFlask-RESTive extension to work with identifiers.\n\n[![Build Status](https://travis-ci.org/left-join/flask-restive-identifiers.svg?branch=master)](https://travis-ci.org/left-join/flask-restive-identifiers)\n[![Coverage Status](https://coveralls.io/repos/github/left-join/flask-restive-identifiers/badge.svg?branch=master)](https://coveralls.io/github/left-join/flask-restive-identifiers?branch=master)\n[![Code Health](https://landscape.io/github/left-join/flask-restive-identifiers/master/landscape.svg?style=flat)](https://landscape.io/github/left-join/flask-restive-identifiers/master)\n[![PyPI Version](https://img.shields.io/pypi/v/Flask-RESTive-Identifiers.svg)](https://pypi.python.org/pypi/Flask-RESTive-Identifiers)\n\n\n## Installation\n```bash\npip install flask-restive-identifiers\n```\n\n## How to use\n\nThe library based on postgresql sequences, so you should to configure your\napplication to use postgresql first:\n```python\nfrom flask import Flask\n\napp = Flask(__name__)\n\napp.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://user:password@localhost:5432/database'\n```\n\nThe library provides function generate_id that can be used as is:\n```python\n>>> from flask_restive_identifiers import generate_id\n\n>>> generate_id(namespace='test')\n>>> 1\n>>> generate_id(namespace='test')\n>>> 2\n>>> generate_id(namespace='test')\n>>> 3\n>>> generate_id(namespace='new_space')\n>>> 1\n```\n\nThe library provides schema that automatically generates auto-increment id.\n\nThe sequence name can be changed with meta attribute identifier_namespace:\n```python\nfrom flask_restive import fields\nfrom flask_restive_identifiers import IntegerIDSchema\n\n\nclass ScientistSchema(IntegerIDSchema):\n first_name = fields.String(required=True)\n last_name = fields.String(required=True)\n\n class Meta(IntegerIDSchema.Meta):\n identifier_namespace = 'scientists'\n\n```\n\nEach loading without id generates new auto-increment id:\n```python\n>>> schema = ScientistSchema()\n>>> data, errors = schema.load({'first_name': 'Albert', 'last_name': 'Einstein'})\n>>> data.id\n1\n>>> data, errors = schema.load({'first_name': 'Nicolaus', 'last_name': 'Copernicus'})\n>>> data.id\n2\n```\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/left-join/flask-restive-identifiers.git", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/left-join/flask-restive-identifiers", "keywords": "Flask-RESTive,generate,id", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-RESTive-Identifiers", "package_url": "https://pypi.org/project/Flask-RESTive-Identifiers/", "platform": "any", "project_url": "https://pypi.org/project/Flask-RESTive-Identifiers/", "project_urls": { "Download": "https://github.com/left-join/flask-restive-identifiers.git", "Homepage": "https://github.com/left-join/flask-restive-identifiers" }, "release_url": "https://pypi.org/project/Flask-RESTive-Identifiers/0.0.3/", "requires_dist": [ "flask-restive (>=0.0.2)", "sqlalchemy (>=1.1.13)", "sqlalchemy-utils (>=0.32.12)", "psycopg2 (>=2.7.3.1)" ], "requires_python": "", "summary": "Flask-RESTive extension to work with identifiers.", "version": "0.0.3" }, "last_serial": 3177567, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8844b38e63505944c2b0a16a56e221bb", "sha256": "ca02bccb963ae367da32e2f5ede8de593cc673cbe36c40644be43e102de38220" }, "downloads": -1, "filename": "Flask_RESTive_Identifiers-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8844b38e63505944c2b0a16a56e221bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6329, "upload_time": "2017-09-14T17:32:06", "url": "https://files.pythonhosted.org/packages/30/09/d0db234967fbc52aed004878fd8e36d2dc5007e204669c69be565cb62922/Flask_RESTive_Identifiers-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3563cb0b361086e2a6c43e804e45d4b8", "sha256": "70913110f414dbc474454718fca6722b30f87e3f12abc6f4c410c1696eb99e52" }, "downloads": -1, "filename": "Flask-RESTive-Identifiers-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3563cb0b361086e2a6c43e804e45d4b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3330, "upload_time": "2017-09-14T17:32:07", "url": "https://files.pythonhosted.org/packages/1a/c8/82b5bc4c746ba4578125b566ada5174d05e5821e42b15abf79a6d4b5b0fd/Flask-RESTive-Identifiers-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "145c9d94a31824b24ee24b05ededf530", "sha256": "c822d8a6db6da49697337964b57f13564074b943e02b560bc6721bf2029b01e6" }, "downloads": -1, "filename": "Flask-RESTive-Identifiers-0.0.2.tar.gz", "has_sig": false, "md5_digest": "145c9d94a31824b24ee24b05ededf530", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3410, "upload_time": "2017-09-15T18:16:28", "url": "https://files.pythonhosted.org/packages/ab/fa/b6523d51f72a8340a85e94ca5b941c870856fa11ef65e9d0c3f7845677f6/Flask-RESTive-Identifiers-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "3a5b4b86bcb0559828c337e4555430ed", "sha256": "ac1ab573c9d37a940bece113e0eb84b1f3785b1b9c161cde6abf9cb87ebeaf89" }, "downloads": -1, "filename": "Flask_RESTive_Identifiers-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3a5b4b86bcb0559828c337e4555430ed", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6356, "upload_time": "2017-09-15T21:23:47", "url": "https://files.pythonhosted.org/packages/8f/e9/a23583336cd3e2ecc79911a14cb9e34fe7f5cbdbc42ee8335b2c1926b958/Flask_RESTive_Identifiers-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13ef06a426c6768a8b4fca78e013c225", "sha256": "f8dd11d70327b1f0371c1672eda10d5acb0ce815f5a47deb32a90ac38521d8ad" }, "downloads": -1, "filename": "Flask-RESTive-Identifiers-0.0.3.tar.gz", "has_sig": false, "md5_digest": "13ef06a426c6768a8b4fca78e013c225", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3409, "upload_time": "2017-09-15T21:23:49", "url": "https://files.pythonhosted.org/packages/24/fb/a688b769938896374e445a4ceb3e0950ccacf79cf34133eca917b1b726cd/Flask-RESTive-Identifiers-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a5b4b86bcb0559828c337e4555430ed", "sha256": "ac1ab573c9d37a940bece113e0eb84b1f3785b1b9c161cde6abf9cb87ebeaf89" }, "downloads": -1, "filename": "Flask_RESTive_Identifiers-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3a5b4b86bcb0559828c337e4555430ed", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6356, "upload_time": "2017-09-15T21:23:47", "url": "https://files.pythonhosted.org/packages/8f/e9/a23583336cd3e2ecc79911a14cb9e34fe7f5cbdbc42ee8335b2c1926b958/Flask_RESTive_Identifiers-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13ef06a426c6768a8b4fca78e013c225", "sha256": "f8dd11d70327b1f0371c1672eda10d5acb0ce815f5a47deb32a90ac38521d8ad" }, "downloads": -1, "filename": "Flask-RESTive-Identifiers-0.0.3.tar.gz", "has_sig": false, "md5_digest": "13ef06a426c6768a8b4fca78e013c225", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3409, "upload_time": "2017-09-15T21:23:49", "url": "https://files.pythonhosted.org/packages/24/fb/a688b769938896374e445a4ceb3e0950ccacf79cf34133eca917b1b726cd/Flask-RESTive-Identifiers-0.0.3.tar.gz" } ] }