注意:我不是在尝试提供 RESTful api,而是在尝试调用一个。
def index( request, *args, **kwargs ):
context = {}
context['some_json'] = make_remote_api_call( "http://exampl.com/objects/" )
return render_to_response( 'index.html', context, context_instance=RequestContext(request) )
或者这是荒谬的,我应该让客户总是这样做吗?基本上,我很好奇如何正确划分我的网站,以便不同的服务器(内部 protected 服务器)可以提供不同的信息子集。
最佳答案
使用 requests图书馆。 Here is some discussion在上面,我在 PyOhio 做了一个关于“使用 Python 使用 Web API”的演讲,你可能会觉得有趣或有帮助
关于django - 你如何让 Django 进行 RESTful 调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7699796/