How to fix python requests ConnectTimeout error?

by scrapecrow Dec 19, 2022

ConnectTimeout error is seen when using Python requests module for web scraping with explicit timeout parameter:

import requests
connect_timeout = 0.1
read_timeout = 10
response = requests.get("http://scrapfly.io/", timeout=(connect_timeout, read_timeout))
# will raise
# ConnectTimeout: HTTPConnectionPool(host='scrapfly.io', port=80):

The ConnectTimeout exception means that the server has refused to connect with our client in the given amount of time. This could be because of technical difficulties or explicit bot blocking. Try increasing the connect timeout.

If you're encountering a lot of ConnectTimeout exceptions your scraper is being blocked by the website. For more on that see our guide how to scrape without getting blocked

See related errors: ReadTimeout

Related Articles

Guide to Python requests POST method

Discover how to use Python's requests library for POST requests, including JSON, form data, and file uploads, along with response handling tips.

PYTHON
REQUESTS
HTTP
Guide to Python requests POST method

Guide to Python Requests Headers

Our guide to request headers for Python requests library. How to configure and what do they mean.

PYTHON
REQUESTS
HTTP
Guide to Python Requests Headers

How to Scrape YouTube in 2025

Learn how to scrape YouTube, channel, video, and comment data using Python directly in JSON.

SCRAPEGUIDE
PYTHON
HIDDEN-API
How to Scrape YouTube in 2025

Guide to List Crawling: Everything You Need to Know

In-depth look at list crawling - how to extract valuable data from list-formatted content like tables, listicles and paginated pages.

CRAWLING
BEAUTIFULSOUP
PYTHON
Guide to List Crawling: Everything You Need to Know

How to Find All URLs on a Domain

Learn how to efficiently find all URLs on a domain using Python and web crawling. Guide on how to crawl entire domain to collect all website data

CRAWLING
PYTHON
How to Find All URLs on a Domain

How to Capture and Convert a Screenshot to PDF

Quick guide on how to effectively capture web screenshots as PDF documents

SCREENSHOTS
PYTHON
NODEJS
How to Capture and Convert a Screenshot to PDF