How do i set a timeout value for python’s mechanize?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Alex is correct:
mechanize.urlopentakes atimeoutargument. Therefore, just insert a number of seconds in floating point:mechanize.urlopen('http://url/', timeout=30.0).The background, from the source of
mechanize.urlopen:What is
mechanize._sockettimeout._GLOBAL_DEFAULT_TIMEOUTyou ask? It’s just thesocketmodule’s setting.