django-resource
Resource centered REST API clients
Ideas on how to use
Not all features stated in the following examples are implemented. This section serves only as motivation for future functionalities.
import resources
class PersonResource(resources.Resource):
class Meta:
base_endpoint = 'http://api.com/v1/persons/'
class PageResource(resources.Resource):
class Meta:
endpoints = {
'delete': 'http://api.com/v1/pages/{}/'
'filter': 'http://api.com/v1/pages/'
'get': 'http://api.com/v1/pages/{}/'
'patch': 'http://api.com/v1/pages/{}/'
'post': 'http://api.com/v1/pages/'
'put': 'http://api.com/v1/pages/'
}
owner = resources.RelatedField(
PersonResource,
source_field='owner_url', # default is owner_id
auto_follow=True, # default is False
)
comments = resources.MultipleRelatedField(
CommentResource,
source_field='comments_url',
)
# GET / single
person = Person.objects.get(pk=1)
print(person.name)
# GET / list
person_reqset = Person.objects.filter(age=18)
for person in person_reqset: # lazy request
print(person.name)
# POST
person = Person.objects.create(name='John Doe', age=18)
# PATCH
person.age = 20
person.save()
# PUT
person = Person.objects.update_or_create(name='John Doe', age=30)
Metadata
Release files for resources 0.0.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 |
|---|---|---|---|---|
| resources-0.0.1.tar.gz | 3.7 kB | Without provenance | Details for resources-0.0.1.tar.gz |
Release files / resources-0.0.1.tar.gz
| Download URL | resources-0.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02547fbca96492b4a9e0a39c83bc922b8ed8f2969ee9909ceedf3609821eb900
|
|
BLAKE2b-256 checksum How to use checksums |
0d9892a43ff6fb8773590ef1edf21383a0b089a8eb0a6f18c5c2d93a8a49b864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for resources 0.0.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.