Metadata-Version: 2.1
Name: spook
Version: 0.1.0rc0
Summary: Django Rest Framework library to interconnect external APIs
License: MIT
Author: Pablo Moreno
Author-email: pablomoreno.inf@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: django (>=1.11.0)
Requires-Dist: djangorestframework (>=3.11.0,<4.0.0)
Requires-Dist: requests (>=2.24.0,<3.0.0)
Description-Content-Type: text/markdown

# Django Spook

Library to interconnect multiple external HTTP APIs as Http Services

## Installation

```bash
pip install django-spook
```

## Usage

Declare your internal model

```python
class MyModel(models.Model):
    name = models.CharField(max_length=16)
    age = models.IntegerField(default=0)
```

Declare a serializer class for your external service

```python
from rest_framework import serializers

class MyModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MyModel
        fields = ('name', 'age', )
```

Declare a Http Service class

```python
from spook.services import HttpService

class MyService(HttpService):
    model = MyModel
    serializer_class = MyModelSerializer
    api_url = 'https://my.external/api'
```

And you can instance MyService class and use the methods

```python
service = MyService()

response = service.list()
data = response.data_set.data
service.get_queryset(data=data)
```
