ArcStack Django API Framework
This is a simple yet extensible API framework for Django that you can create API endpoints Django way.
Check out Documentation for more info.
Sponsoring
Maintaining an open-source project requires attention and time. If you like this project and want it to be developed further, you might want to consider giving me a support.
If you are using ArcStack API in your project, please give me your feedback at me@gokhan.tr.
Installation
pip install arcstack-django-api
Usage
ArcStack Django API comes with CommonMiddleware enabled. This middleware
can convert your endpoint results to HttpResponse, handle exceptions and
check for logged in users.
Usage with class-based views:
from arcstack_api import Endpoint, APIError
class StatusOk(Endpoint):
# By default all defined enpoints do not require logged in user
# You can change this behavior with this class constant.
LOGIN_REQUIRED = True
def get(self, request, a: str | None = None):
if a == "something_invalid":
# This `dict` will be converted to `JSON` and `HttpResponse`
# will be generated
raise APIError(
{"error": "you have passed invalid argument"}
# The default status_code is `400` but it can be changed to
# anything you want.
status_code=480
)
# ArcStack API will serialize this to JSON and generate
# a `HttpResponse` for you.
return {"status": "OK"}
Usage with function views:
from arcstack_api import api_endpoint, Endpoint, APIError
@api_endpoint(login_required=True)
def statusOk(request, a: str | None = None):
if a == "something_invalid":
raise APIError(
{"error": "you have passed invalid argument"}
status_code=480
)
return {"status": "OK"}
In urls.py
from django.urls import path
from . import endpoints
urlpatterns = [
# For class-based views:
path("api", endpoints.StatusOk.as_endpoint()),
# For function views:
path("api", endpoints.statusOk),
]
Metadata
Release files for arcstack-django-api 0.2.1
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 |
|---|---|---|---|---|
| arcstack_django_api-0.2.1.tar.gz | 8.1 kB | Without provenance | Details for arcstack_django_api-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| arcstack_django_api-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for arcstack_django_api-0.2.1-py3-none-any.whl |
Total release size: 18.1 kB
Release files / arcstack_django_api-0.2.1.tar.gz
| Download URL | arcstack_django_api-0.2.1.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e53786d5ff02ba033f2b075696a360a7309e0d21e60d611bfb5985d43598a6d0
|
|
BLAKE2b-256 checksum How to use checksums |
3366d9609efbfdbb173abeea7f841634cdab75555af758f83609c1788a7532fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure
|
Release files / arcstack_django_api-0.2.1-py3-none-any.whl
| Download URL | arcstack_django_api-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baad75d410bb95bcc1b923aa7e7f28232fb470066583357651d9a9303bea7807
|
|
BLAKE2b-256 checksum How to use checksums |
031afd35e071a49a4c15269a13ab1060856bf70504b0cfdffda815747925d24b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure
|
Security for arcstack-django-api 0.2.1
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.