Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Django remote resources

Sync remote API resources to Django models

Quick start

pip install django-remote-resources

Add AbstractRemoteResource to your model (1), and define a mapping between the fields in the remote data to your model's fields (2), and create a custom QuerySet manager for the model, inheriting from RemoteResourceQuerySet and define method get_remote_data_iterator (3). Optionally define a remote_data_key_field that points to a unique identifier on the remote data (4).

class ResourceMirrorQuerySet(  # (3)
    RemoteResourceQuerySet
):
    def get_remote_data_iterator(self, *args, **kwargs):
        client = RemoteClient()
        return client.get_data(**kwargs)  # should return an iterator, with each item representing a page of data


class ResourceMirror(
    AbstractRemoteResource,  # (1)
    models.Model
):
    remote_id = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    email = models.EmailField()

    objects = ResourceMirrorQuerySet.as_manager()  # (3)

    remote_to_model_fields_map = {  # (2)
        'id': 'remote_id',
        'name': 'name',
        'email': 'email',
    }
    remote_data_key_field = 'id'  # (4)

Development and Testing

IDE Setup

Add the example directory to the PYTHONPATH in your IDE to avoid seeing import warnings in the tests modules. If you are using PyCharm, this is already set up.

Running the Tests

Install requirements

pip install -r requirements.txt

For local environment

pytest

For all supported environments

tox

Metadata

Release files for django-remote-resources 0.2.0a13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-remote-resources 0.2.0a13
File Size Uploaded Provenance
django-remote-resources-0.2.0a13.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-remote-resources 0.2.0a13
File Interpreter ABI Platform
django_remote_resources-0.2.0a13-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / django-remote-resources-0.2.0a13.tar.gz

Download URL django-remote-resources-0.2.0a13.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
47ba370b712b834a0aec65d5efbdf5cc6e20d3a2dff89061dee4cfe269996f05
BLAKE2b-256 checksum
How to use checksums
8cc6a5f8e34af357955244ecee4a441d78fc1a89ea85865195e6a58c16dfc36a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10

Release files / django_remote_resources-0.2.0a13-py3-none-any.whl

Download URL django_remote_resources-0.2.0a13-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52da2d431ddb8b80e9c90b2dad173eeafbb05aaf34ddc648af090fa8f8378ce4
BLAKE2b-256 checksum
How to use checksums
ed8dcd30ae029a59bb8d890f439d0f3469f1f1af8cc4dd7542babd35e9b7360e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10

Security for django-remote-resources 0.2.0a13

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page