urlopen error [Errno 110] Connection timed out

2,040 views
Skip to first unread message

suas...@gmail.com

unread,
Jan 8, 2018, 11:49:56 AM1/8/18
to Django users

I use pythonanywhere. At this time, "urlopen error [Errno 110] Connection timed out" occurs. So I set CACHES TIMEOUT to None in Django settings.py. However, error 110 still occurs. Do I need to change the timeout value in urllib / request.py? I would really appreciate your help in this matter.

Julio Biason

unread,
Jan 8, 2018, 12:40:23 PM1/8/18
to django...@googlegroups.com
Hello,

Where does this happen? Do you do urlopen somewhere? (IIRC, changing Django settings doesn't affect internal Python objects).

urllib.request has a timeout, it's the second parameter after the data: https://docs.python.org/3/library/urllib.request.html?highlight=urllib#urllib.request.urlopen

But you shouldn't do anything long while answering a request. You should probalby use something like Celery to retrieve information in the background, freeing the request (and later show the proper response).

On Mon, Jan 8, 2018 at 2:30 PM, <suas...@gmail.com> wrote:

I use pythonanywhere. At this time, "urlopen error [Errno 110] Connection timed out" occurs. So I set CACHES TIMEOUT to None in Django settings.py. However, error 110 still occurs. Do I need to change the timeout value in urllib / request.py? I would really appreciate your help in this matter.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2a798988-c7ab-4ec8-b967-e4f00af5b27b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101  |  Mobile: +55 51 99907 0554

suas...@gmail.com

unread,
Jan 9, 2018, 12:06:18 AM1/9/18
to Django users
yes, i use a urlopen to crawl the some site. 
like this:
   html = urlopen(page)
   bs0bj = BeautifulSoup(html, "html.parser")

and error happen  in " /usr/lib/python3.5/urllib/request.py in do_open, "

when i open 'the site', the loading time is longer than others. then others which i crawl dont happen error 110.
so i think the site loading time is the source of error. maybe the loading time exceed the timeout deadline.

i want to length the timeout deadline, like timeout = None...


2018년 1월 9일 화요일 오전 1시 49분 56초 UTC+9, suas...@gmail.com 님의 말:

Jason

unread,
Jan 9, 2018, 6:07:15 AM1/9/18
to Django users
You really should use an async task worker like Celery for this, to get the scraping outside of Django's request-response loop.

Is the urlopen happening with any specific URL or seemingly at random?

suas...@gmail.com

unread,
Jan 9, 2018, 6:33:07 AM1/9/18
to Django users
Thanks.!

I had better use an async task worker! i need to study the worker...

the error happens with a specific URL.



2018년 1월 9일 화요일 오후 8시 7분 15초 UTC+9, Jason 님의 말:

Jason

unread,
Jan 9, 2018, 8:50:04 AM1/9/18
to Django users
Are you able to load the URL directly in the browser without issue?  How about using an API client like Postman?  

suas...@gmail.com

unread,
Jan 13, 2018, 11:08:35 AM1/13/18
to Django users
Yes! i can load the Url ("http://www.aaasports.co.kr/front/productlist.php?code=001000000000&brandcode=2&listnum=30&sort=&block=0&gotopage=1") 
without issue. I think the time to load the URL is longer than any other URL, but it does not take much long.

I searched for the Postman you suggested. I do not know how to solve this problem through Postman...


2018년 1월 9일 화요일 오후 10시 50분 4초 UTC+9, Jason 님의 말:
Reply all
Reply to author
Forward
0 new messages