I want to make a Django view that does the following:
HttpRequest
on api/some/url/or/other
some/url/or/other
(rewrite the URL, basically)
HttpResponse
What tools already exist in Django to do this?
None.
You'll have to code your own wrapper utility, using one of httplib
/ urllib
/ urllib2
libs to connect to the other server.
Most likely you will have to extract all the relevant info from the HttpRequest
object and use that to manually construct your own request in said util function.
Regarding receiving the response from that other server, it will depend a little bit on wether you need that response only asynchronously or quasi-synchronously.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.