Consuming a RESTful API with Django

前端 未结 2 1238

I\'m building a Django application that needs to interact with a 3rd party RESTful API, making various GETs, PUTs, etc to that resource. What I\'m looking for is a good way to

相关标签:
2条回答
  • 2021-02-08 08:43

    Make the REST calls using the builtin urllib (a bit clunky but functional) and wrap the interface into a class, with a method for each remote call. Your class can then translate to and from native python types. That is what I'd do anyway!

    0 讨论(0)
  • 2021-02-08 08:53

    The requests library makes it easy to write a REST API consumer. There is also a Python library called slumber, which is built on top of requests, for the explicit purpose of consuming REST APIs. How well that will work for you likely depends on how RESTful the API really is.

    0 讨论(0)
提交回复
热议问题