How do you get Django to make a RESTful call?

后端 未结 3 1276
感动是毒
感动是毒 2020-12-24 08:11

Note: I\'m not trying to provide a RESTful api, I\'m trying to call one.

def index( request, *args, **kwargs ):
    context = {}
    context[\'some_json\'] =         


        
3条回答
  •  猫巷女王i
    2020-12-24 08:41

    “RESTful call” in practice just means making an HTTP request. There are a couple of built-in modules in Python that let you do this:

    • httplib
    • urllib2

    Then there are 3rd-party modules, like the one mentioned by @Issac (which, based on my very limited experience with urllib2 and httplib, looks much better than them for your purposes).

提交回复
热议问题