Pyramid Subqueries

I need to call GET, POST, PUT, etc. requests for a different URI because of the search, but I cannot find a way to do this inside with a pyramid. Is there any way to do this at the moment?

+5
source share
3 answers

Just use existing python libraries to invoke other web servers.

In python 2.x use urllib2, for python 3.x use urllib.request. Alternatively, you can install requests.

Please note that calling external sites from your server during the service of the request may mean that your visitors will ultimately expect the third-party web server to stop responding. Make sure you set decent timeouts.

+9
source

webob api 1.2

from webob import Request
r = Request.blank("http://google.com")
response = r.send()

, , .

from webob import Request
r = Request.blank("http://facebook.com",method="DELETE")

, http,

print r

DELETE  HTTP/1.0
Host: facebook.com:80

docs

+6

Also check the response status code: response.status_int I use it, for example, to examine my internal URIs and to check if this relative URI is really served by the framework (for example, to create breadings and intermediate paths as links, only if there are pages behind)

+1
source

All Articles