Django Rest Framework library to interconnect external APIs
Project description
Django Spook
Library to interconnect multiple external HTTP APIs as Http Services
Installation
pip install spook
Usage
Declare your internal model
class MyModel(models.Model):
name = models.CharField(max_length=16)
age = models.IntegerField(default=0)
Declare a serializer class for your external service
from rest_framework import serializers
class MyModelSerializer(serializers.ModelSerializer):
class Meta:
model = MyModel
fields = ('name', 'age', )
Declare a Http Service class
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
service = MyService()
response = service.list()
data = response.data_set.data
service.get_queryset(data=data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spook-0.1.0rc1.tar.gz
(5.0 kB
view hashes)