Python Web Scraping: requests, Scrapy or Playwright?

Cover for “Python Web Scraping: requests, Scrapy or Playwright?”: comparison of requests, Scrapy and Playwright defaults and a rule for choosing

4 min read

Python has three common answers to “how do I scrape this”: the requests library, the Scrapy framework, and Playwright driving a real browser. They are not three versions of the same thing. Each sends very different traffic to the site, costs very different amounts to run, and fails in different ways. Choosing well is mostly a matter of knowing where the data lives.

Key takeaways

  • requests sends one HTTP request and gives you the response. No crawling, no scheduling, no retries and no timeout unless you add them.
  • Scrapy is a crawling framework: concurrency, retries, throttling, pipelines. Its project template turns robots.txt obedience on.
  • Playwright runs a real browser. It executes JavaScript and loads every subresource, which makes it the heaviest option for you and for the site.
  • Look at the page source first. If the data is in the HTML or a JSON endpoint, you don’t need a browser.

What each one actually does

requestsScrapyPlaywright
What it isHTTP client libraryAsynchronous crawling frameworkBrowser automation library
Executes JavaScriptNoNo (without add-ons)Yes
Requests per pageOne per callOne per scheduled requestThe page plus its scripts, styles, images and API calls
ConcurrencyYours to buildBuilt in: 16 requests, 8 per domain by defaultYours to manage, one browser context per task
RetriesNone by defaultOn by default: 2 retries for 5xx, 408 and 429None for page loads
robots.txtNot checkedSetting defaults to off; the project template turns it onNot checked
Default timeoutNone180 s30 s
Good forSmall, targeted jobs and API callsCrawls of thousands of pages on a schedulePages whose data exists only after scripts run

Defaults from the Scrapy settings reference, the Requests advanced usage guide and the Playwright Python docs, checked October 2026.

The defaults that bite

The default that hangs your scraper

Default timeout per request or action, out of the box

0 s50 s100 s150 s200 srequestsnoneScrapy180 sPlaywright30 sNo timeout means a stalled connection can hold a worker indefinitely.
Sources: Requests docs, Scrapy settings, Playwright docs, checked October 2026. Graphic: JsonEngine.
Data behind the chart
ToolDefault timeout
requestsnone
Scrapy (DOWNLOAD_TIMEOUT)180 s
Playwright (actions, navigation)30 s

requests has no timeout. The Requests documentation warns that without one, “your code may hang for minutes or more”. Always pass timeout=(connect, read).

Scrapy’s robots.txt setting depends on how you started. ROBOTSTXT_OBEY defaults to False in Scrapy’s global defaults, for historical reasons, but the settings.py generated by scrapy startproject sets it to True. A spider run outside a generated project, or a project where someone deleted the line, ignores robots.txt silently.

Scrapy retries, and so might everything around it. The retry middleware is on by default. If your scheduler also re-runs failed jobs, you have two retrying layers.

Scrapy’s delay defaults to zero. DOWNLOAD_DELAY is 0 and AutoThrottle is off. Eight concurrent requests to one domain with no delay is not a polite default; set a delay or enable AutoThrottle.

Playwright waits for you, which hides cost. Its locators auto-wait and retry until elements appear, which makes scripts robust and slow pages invisible. A page that takes 20 seconds to settle still “works”.

Pick the lightest tool that reaches the data

Pick the lightest tool that reaches the data

A decision tree for Python collection jobs

Where is the data?check view-source firstIn the server HTMLor a public JSON endpointOnly after JavaScript runsrendered in the browserrequestsa few hundred pagesScrapycrawls, schedulesFind the JSON callNetwork tab, then requestsPlaywrightlast resortoften existsonly if it doesn'tIn every branch: obey robots.txt, identify your crawler, set timeouts and a per-domain rate.
JsonEngine’s working rule. Graphic: JsonEngine.

Most product pages carry their data in the server HTML, either as JSON-LD, as embedded application state, or as plain markup. We showed this for five large US retailers in where e-commerce data actually lives. In those cases a browser adds nothing but cost. When data does arrive later, it usually comes from a JSON request you can see in the browser’s Network tab; calling that endpoint directly with requests or Scrapy, where the site permits it, is lighter for everyone. Playwright earns its place when neither is true.

Same job, three ways

requests
import requests

HEADERS = {"User-Agent": "ExampleCollector/1.0 (+https://example.com/bot)"}
r = requests.get("https://shop.example.com/p/123", headers=HEADERS, timeout=(5, 30))
r.raise_for_status()
html = r.text
Scrapy
import scrapy

class ProductSpider(scrapy.Spider):
    name = "products"
    start_urls = ["https://shop.example.com/p/123"]
    custom_settings = {
        "ROBOTSTXT_OBEY": True,          # explicit, whatever the project says
        "DOWNLOAD_DELAY": 2.0,
        "CONCURRENT_REQUESTS_PER_DOMAIN": 1,
        "USER_AGENT": "ExampleCollector/1.0 (+https://example.com/bot)",
    }

    def parse(self, response):
        yield {"url": response.url,
               "title": response.css("h1::text").get(),
               "ld_json": response.css('script[type="application/ld+json"]::text').getall()}
Playwright
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(user_agent="ExampleCollector/1.0 (+https://example.com/bot)")
    page.route("**/*", lambda route: route.abort()
               if route.request.resource_type in ("image", "font", "media")
               else route.continue_())                      # skip heavy assets
    page.goto("https://shop.example.com/p/123", timeout=30_000)
    title = page.get_by_role("heading", level=1).inner_text()
    browser.close()

The Playwright version blocks images, fonts and media it doesn’t need. That cuts bandwidth for you and load for the site, but it is still a full browser running the page’s scripts and their API calls. Note too that none of the three checks robots.txt unless you tell it to, so the Scrapy example sets it explicitly.

A rule of thumb

  • Fewer than a few hundred pages, data in the HTML or an API: requests plus a small loop with timeouts, a delay and logging.
  • Thousands of pages, on a schedule, with retries and exports: Scrapy, with ROBOTSTXT_OBEY, a delay and a per-domain limit set explicitly.
  • Data only exists after scripts run and there is no JSON call you can use: Playwright, with asset blocking and the same rate limits.

Whichever you choose, the politeness rules don’t change. We list them in web scraping vs official APIs, and they matter more than the library.

Quick answers

Is Scrapy better than requests for web scraping?

For crawls of many pages, usually yes: Scrapy adds scheduling, concurrency, retries and pipelines that you would otherwise build yourself. For a handful of pages or API calls, requests is simpler.

When do I need Playwright instead of requests?

Only when the data appears after JavaScript runs and there is no underlying JSON request you can call directly. Check the page source and the browser’s Network tab first.

Does Scrapy obey robots.txt by default?

The global default for ROBOTSTXT_OBEY is False, but projects created with scrapy startproject set it to True in settings.py. Set it explicitly in your spider to be sure.

Does requests have a default timeout?

No. Without a timeout argument a request can wait indefinitely on a stalled connection. Pass a (connect, read) tuple on every call.

What is Playwright’s default timeout?

30 seconds for actions and navigation, unless you change it with set_default_timeout or a per-call timeout.

Rather not maintain the scrapers?

We build and run collectors in whichever tool fits each site, and deliver the data, not the code. See custom datasets.