1👍
✅
Django Rest Framework is for creating REST APIs, not consuming them. To simply call a REST API from Django/Python you can do the following using json
and urllib2
which are standard:
import json
import urllib2
data = json.load(urllib2.urlopen('http://myapi.com/'))
or you can use the 3rd party library requests
:
import requests
r = requests.get('http://myapi.com/')
r.json()
Source:stackexchange.com