Is it possible to request other api which is on another server in a Tastypie resource class?

7 views
Skip to first unread message

zhong zhao

unread,
Jun 3, 2016, 1:11:27 PM6/3/16
to Tastypie

I'm using Django 1.9.6 + Tastypie to implement RESTFUL api, there is an api that need to fetch data from api whitch is on another server, I don't know how to do it.

All the example I'd found is like this:

from tastypie.resources import ModelResource
from services.models import Product
from tastypie.authorization import Authorization


class ProductResource(ModelResource):
    class Meta:
        queryset = Product.objects.all()
        resource_name = 'product'
        allowed_methods = ['get']
        authorization = Authorization()

The resource class fetch data from app's models(local database), but what I want is request an API which is on another server in the resource class. Any body know how to do it? 

Maybe the question is stupid.

Thanks :)


Reply all
Reply to author
Forward
0 new messages