Flask Pocket
FlaskPocket is a Flask extension that integrates PocketBase, a backend service.
Prerequisites
Installation
pip install flask-pocket
Or install from the cloned repository:
git clone https://github.com/codewithmpia/flask_pocket.git
cd flask_pocket
pip install .
Configuration
Add the following configurations to your Flask app:
app.config["POCKETBASE_URL"] = "your_pocketbase_url"
app.config["POCKETBASE_ADMIN_EMAIL"] = "your_admin_email"
app.config["POCKETBASE_ADMIN_PASSWORD"] = "your_admin_password"
Usage
from flask import Flask
from flask_pocket import FlaskPocket
app = Flask(__name__)
app.config["POCKETBASE_URL"] = "your_pocketbase_url"
app.config["POCKETBASE_ADMIN_EMAIL"] = "your_admin_email"
app.config["POCKETBASE_ADMIN_PASSWORD"] = "your_admin_password"
pocket = FlaskPocket(app)
Queries
Get All Objects
try:
posts = pocket.collection("posts").get_full_list()
except pocket.ClientResponseError as e:
# Handle error
print(f"Error: {e}")
Get One Object
try:
post = pocket.collection("posts").get_one(post_id)
# Generate image url
image_url = pocket.client.get_file_url(post, post.image)
except pocket.ClientResponseError as e:
# Handle error
print(f"Error: {e}")
Create
try:
pocket.collection("contacts").create({
"name": name,
"email": email,
"message": message
})
return redirect(url_for("contact"))
except pocket.ClientResponseError as e:
# Handle error
print(f"Error: {e}")
Edit
try:
pocket.collection("contacts").update(contact_id, {
"name": new_name,
"email": new_email,
"message": new_message
})
except pocket.ClientResponseError as e:
# Handle error
print(f"Error: {e}")
Delete
try:
pocket.collection("contacts").delete(contact_id)
except pocket.ClientResponseError as e:
# Handle error
print(f"Error: {e}")
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions
Contributions are welcome.
Metadata
Release files for flask-pocket 1.0.2
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 | Actions |
|---|---|---|---|---|
| flask_pocket-1.0.2.tar.gz | 3.7 kB | Without provenance | Details for flask_pocket-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_pocket-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for flask_pocket-1.0.2-py3-none-any.whl |
Total release size: 7.7 kB
Release files / flask_pocket-1.0.2.tar.gz
| Download URL | flask_pocket-1.0.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c86bf141229d32a06ae12ebde5f37c14257911fc90067f6bde68b8a51f332bd
|
|
BLAKE2b-256 checksum How to use checksums |
50831d2f5ed408cbabbed4280bb0001bb3edcf5500f98a523b7a2b7816c0551c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / flask_pocket-1.0.2-py3-none-any.whl
| Download URL | flask_pocket-1.0.2-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb43528cd61928aaa31a29d22117806c572e8f59be24d648e8f8b2ed673d6fe5
|
|
BLAKE2b-256 checksum How to use checksums |
525950d0650cbda266b2bc20cd1c22e144780c0f6792307aeef8fd36cd1ab6ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Security for flask-pocket 1.0.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.