473,811 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the timeout value of HTTP

ken
Can you please tell me what is the timeout value of httplib.HTTP?

i.e. how long python will wait for a response in the below code?

h = httplib.HTTP(se lf.url, 8080)
h.putrequest('G ET', '/sample/?url=' + self.url)
h.endheaders()

Thank you.

Mar 29 '07 #1
2 1506
ken <ke*********@gm ail.comwrote:
Can you please tell me what is the timeout value of httplib.HTTP?

i.e. how long python will wait for a response in the below code?

h = httplib.HTTP(se lf.url, 8080)
h.putrequest('G ET', '/sample/?url=' + self.url)
h.endheaders()
HTTP per se does not define any timeout -- if self.url is correctly
resolved by DNS and accepts a TCP connection on port 8080, and then just
hangs forever, you'll be waiting. You can force timeouts yourself by
playing with socket.setdefau lttimeout(...) before you start the HTTP
interaction.
Alex
Mar 29 '07 #2
ken wrote:
i.e. how long python will wait for a response in the below code?

h = httplib.HTTP(se lf.url, 8080)
h.putrequest('G ET', '/sample/?url=' + self.url)
h.endheaders()
For ever.

In Py<=2.5, httplib.HTTP doesn't have a timeout, so you have to do
something like:
>>import socket
socket.setdef aulttimeout(... )
h = httplib.HTTP(.. .)
Beware that *all* sockets created after the call to setdefaulttimeo ut()
will have that default.

httplib.HTTP now has a timeout, but in the development trunk (you'll
have to checkout the SVN code and compile Python yourself, or wait until
Py2.6).

Regards,

--
.. Facundo
..
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3182
by: Scott | last post by:
I have a page that uses a dataset and times-out causing error messages when the user tries to use the dataset after a timeout. How can I either remove the timeout or wrap my code in error code to take them back to the main page when this happens? Scott
4
9553
by: A.M-SG | last post by:
Hi, How can I increase the HTTP Timeout value at the client side? Thank you, Alan
3
5511
by: Andrew Robinson | last post by:
Is there any way to dynamically set the timeout while using forms based authentication? I want to change this value depending on the type of user that logs into my system. I understand that this value lives in the config file but can I change it in code? Thanks, -Andy
11
26530
pbmods
by: pbmods | last post by:
A somewhat obscure hack has emerged recently that is an offshoot of the now-infamous XSS. It is known as Cross-Site Request Forgery, or XSRF for short. XSRF is a form of temporary identity theft that can cause your computer to initiate banking transactions, send emails or text messages, or even change account info on your favorite site... without your ever realizing it! THE GOOD NEWS Before we get started on the doom and gloom, you...
9
19661
by: antonyliu2002 | last post by:
By default, IIS is configured to timeout a session in 20 minutes, which can be changed through the IIS config window. I use InProc sessionState mode. I can also set the session timeout in web.config. So here is my question: If IIS setting has a session timeout value of 20 minutes, but my web.config setting has a session timeout of 30 minutes, will the session time out in 20 minutes or in 30 minutes?
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.