This release is a pre-release and may not be stable for production use.
Flask2Neo4J
Extension Flask for integration with neo4j graph database
Installation
Using pip:
$ pip install flask2neo4j
Usage
Basic Step to usage this extension:
- Create Flask app instance:
import bcrypt
from py2neo import ogm
from flask import Flask, request
from flask2neo4j import Flask2Neo4J
app = Flask(__name__)
- Add NEO4J Config and Initialization Flask2Neo4j Extensions:
app.config["NEO4J_USERNAME"] = "neo4j"
app.config["NEO4J_PASSWORD"] = "neo4j"
app.config["NEO4J_URI"] = "bolt://localhost:7687"
flask2neo = Flask2Neo4J()
flask2neo.init_app(app)
- Create Model using Graph Object if using GraphObject
class Users(ogm.GraphObject):
__primarykey__ = "id"
id = ogm.Property()
username = ogm.Property("username")
password = ogm.Property("password")
def create_password(self, password):
self.password = str(bcrypt.encrypt(password))
@property
def is_exist(self):
return flask2neo.graph.exists(self)
def save(self):
if self.is_exist:
flask2neo.graph.merge(self)
flask2neo.graph.push(self)
else:
flask2neo.graph.create(self)
- Define function register as flask request method
POST
@app.route("/register", methods=["POST"])
def register():
form = request.form
user = Users()
user.username = form['username']
user.create_password(form['password'])
user.save()
return "User Created"
- Run flask app
if __name__ == '__main__':
app.run(port=8500, debug=True)
Open your browser and type into url : http://localhost:8500
Metadata
Release files for Flask2Neo4J 0.1a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| Flask2Neo4J-0.1a1.tar.gz | 2.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Flask2Neo4J-0.1a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / Flask2Neo4J-0.1a1.tar.gz
| Download URL | Flask2Neo4J-0.1a1.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f0f5787a2c29adf3fc8d2564bb9c6548cf8c93d5855d4b1bcf4ae3b64c20a89
|
|
BLAKE2b-256 checksum How to use checksums |
c74c884fb8859b2aa23060182cdec08b269ecf61941cb034cf0efdc35645ea7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0
|
Release files / Flask2Neo4J-0.1a1-py3-none-any.whl
| Download URL | Flask2Neo4J-0.1a1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1673bcad871003b8c4d538bbfbcc8a2f7ed4351283f2f23d84a483830a91a27f
|
|
BLAKE2b-256 checksum How to use checksums |
3c3bb9a47066b7c07884036a9b31c17237b568698396e79777c39f1a32c402f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0
|
Security for Flask2Neo4J 0.1a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.