Try for $3.50

Scrapy Proxy

Connect residential, mobile, or ISP proxies to Scrapy. Route every request through NodeMaven, rotate IPs automatically, target specific locations, and keep credentials outside your code

95% clean IP rate, guaranteed
Residential, mobile & ISP proxies
24/7 expert support

The first proxy
cashback
on the market

Get rewarded every month by
turning used traffic into reusable
proxy credits

Welcome gift
valued at $100+

  • Quality & speed filters
  • ZIP-Level targeting
  • Personal proxy expert

Exclusive quality guarantee

Earn $1 in bonus traffic every time
a proxy fails to perform

Learn more

What is Scrapy, and why use proxies?

Scrapy is an open-source Python framework for building web crawlers and extracting data from websites. Proxies help Scrapy projects reduce IP-based restrictions, collect location-specific data, and scale requests across different IP addresses.

Scrapy’s built-in `HttpProxyMiddleware` supports authenticated proxies. With NodeMaven, you can connect residential, mobile, or ISP proxies and choose rotating or sticky sessions for different scraping workflows

Start testing high-quality proxies for $3.50

Start testing high-quality proxies for $3.50

How to set up NodeMaven proxies in Scrapy

Connect a NodeMaven HTTP proxy to Scrapy using a project-level downloader middleware. This example uses Books to Scrape, a sandbox built for web-scraping practice

Step 1

Install Scrapy and create a project

Create and activate a Python virtual environment:

python3 -m venv scrapy-env

source scrapy-env/bin/activate

Install Scrapy:

python3 -m pip install scrapy

Create the project and example spider:

scrapy startproject nodemaven_scrapy cd nodemaven_scrapy scrapy genspider books books.toscrape.com

If python3 --version also returns “command not found,” install Python 3 from python.org first.

Step 2

Generate a NodeMaven proxy

Sign in to the NodeMaven dashboard and open Proxy Setup. Choose:

  • Proxy type: Residential, Mobile, or ISP
  • Location: Select the required country, region, city, or ISP
  • Session: Rotating or Sticky
  • Filtering: Choose the IP quality option for your workflow
  • Protocol: HTTP

Choose Rotating when you want NodeMaven to change the exit IP between requests. This works well for large-scale crawling, price monitoring, and market research.

Choose Sticky when the spider should keep the same IP for cookies, logins, pagination, or other multi-step workflows.

NodeMaven manages IP rotation behind one gateway, so you do not need to maintain a separate proxy list in Scrapy.

Step 3

Store your NodeMaven credentials securely

Copy the complete proxy username and password from the NodeMaven dashboard.

Keep these credentials outside your Scrapy code by storing them as environment variables in the current terminal session. This allows the proxy middleware to use them without adding sensitive information to middlewares.py or GitHub.

Enter your NodeMaven username securely:

read -s -p "NodeMaven proxy username: " NODEMAVEN_PROXY_USER; echo

Paste the complete username and press Enter. The pasted value will remain hidden.

Enter your proxy password:

read -s -p "NodeMaven proxy password: " NODEMAVEN_PROXY_PASS; echo

Paste the password and press Enter. It will also remain hidden.

Export both variables so Scrapy can access them:

export NODEMAVEN_PROXY_USER NODEMAVEN_PROXY_PASS

Confirm that both variables are available without displaying their values:

[ -n "$NODEMAVEN_PROXY_USER" ] && echo "NodeMaven username: set"

[ -n "$NODEMAVEN_PROXY_PASS" ] && echo "NodeMaven password: set"

You should see:

NodeMaven username: set

NodeMaven password: set

Important: The variables remain available only in the current terminal session. If you close the terminal, enter them again before running the spider.

Step 4

Add the NodeMaven proxy middleware

Make sure the terminal is inside the Scrapy project directory. The prompt should contain nodemaven_scrapy.

Open the project’s middlewares.py file with Nano:

nano nodemaven_scrapy/middlewares.py

Move to the bottom of the file, add a blank line, and paste:

import os

from urllib.parse import quote





class NodeMavenProxyMiddleware:

    def __init__(self):

        username = quote(

            os.environ["NODEMAVEN_PROXY_USER"],

            safe="",

        )

        password = quote(

            os.environ["NODEMAVEN_PROXY_PASS"],

            safe="",

        )




        self.proxy_url = (

            f"http://{username}:{password}"

            "@gate.nodemaven.com:8080"

        )




    def process_request(self, request):

        request.meta.setdefault("proxy", self.proxy_url)

Important: The method must be written as __init__, with two underscores before and after init.

Save and close the file:

  1. Press Control + O.
  2. Press Enter to confirm the filename.
  3. Press Control + X.

Check the file for syntax errors:

python3 -m py_compile nodemaven_scrapy/middlewares.py \

  && echo "Middleware syntax check: passed"

If the code is correct, the terminal will display:

Middleware syntax check: passed

The middleware reads the credentials stored in Step 3, creates an authenticated NodeMaven proxy URL, and assigns it to Scrapy requests. The quote() function safely encodes special characters in the username and password.

Step 5

Enable the middleware in Scrapy

Make sure the terminal is still inside the nodemaven_scrapy project directory.

Open the project settings file:

nano nodemaven_scrapy/settings.py

Look for this existing setting:

ROBOTSTXT_OBEY = True

If it is already present, leave it unchanged. Do not add it a second time.

Move to the bottom of the file and add:

DOWNLOADER_MIDDLEWARES = {

    "nodemaven_scrapy.middlewares.NodeMavenProxyMiddleware": 700,

}




HTTPPROXY_ENABLED = True

If your project has a different package name, replace nodemaven_scrapy with that name. For the project created in Step 1, keep the value exactly as shown.

Save and close the file:

  1. Press Control + O.
  2. Press Enter to confirm the filename.
  3. Press Control + X.

Check the file for Python syntax errors:

python3 -m py_compile nodemaven_scrapy/settings.py \

  && echo "Settings syntax check: passed"

Confirm that Scrapy loaded the settings:

scrapy settings --get DOWNLOADER_MIDDLEWARES

scrapy settings --get HTTPPROXY_ENABLED

scrapy settings --get ROBOTSTXT_OBEY

The output should include the NodeMaven middleware and show True for both settings:

{'nodemaven_scrapy.middlewares.NodeMavenProxyMiddleware': 700}

True

True

Scrapy’s built-in HttpProxyMiddleware reads the proxy URL from request.meta["proxy"]. The custom middleware added in Step 4 supplies the NodeMaven proxy URL.

Use responsible download delays and concurrency limits based on the target website.

Step 6

Create the example spider

Make sure the terminal is inside the nodemaven_scrapy project directory.

Open the generated spider file:

nano nodemaven_scrapy/spiders/books.py

Nano will display the basic spider created in Step 1.

Remove the existing code:

  1. Move the cursor to the first line.
  2. Press Control + K repeatedly until every line has been removed.

Paste the following code into the empty file:

import scrapy





class BooksSpider(scrapy.Spider):

    name = "books"

    allowed_domains = ["books.toscrape.com"]

    start_urls = ["https://books.toscrape.com/"]




    def parse(self, response):

        for book in response.css("article.product_pod"):

            yield {

                "title": book.css(

                    "h3 a::attr(title)"

                ).get(),

                "price": book.css(

                    ".price_color::text"

                ).get(),

                "availability": " ".join(

                    book.css(

                        ".availability::text"

                    ).getall()

                ).strip(),

            }

Save and close the file:

  1. Press Control + O.
  2. Press Enter to confirm the filename.
  3. Press Control + X.

Check the spider for syntax errors:

python3 -m py_compile nodemaven_scrapy/spiders/books.py \

  && echo "Spider syntax check: passed"

Confirm that Scrapy recognizes the spider:

scrapy list

The terminal should display:

Spider syntax check: passed

books

This example spider opens Books to Scrape and extracts each book’s:

  • Title
  • Price
  • Availability

We use https://books.toscrape.com/ only as an example. It is a sandbox website created specifically for web-scraping demonstrations.

For a real project, replace the URL and extraction rules with your target website. Make sure you have permission to access and scrape it.

Screenshot: The books.py file showing the example URL and the selectors for title, price, and availability, together with the Spider syntax check: passed confirmation.

Step 7

Run the spider through NodeMaven

From the Scrapy project directory, run:

scrapy crawl books -O books.json

The -O option creates books.json or overwrites the file if it already exists.

Scrapy will route the spider’s requests through gate.nodemaven.com using the location and session settings contained in the generated NodeMaven username.

Wait until the crawl finishes. A successful run should show:

  • An HTTP 200 response
  • Extracted book items in the logs
  • No proxy connection errors
  • No 407 Proxy Authentication Required error
  • A Spider closed (finished) message
  • A books.json file in the project directory
Step 8

Check the Scrapy output

The crawl creates books.json inside the Scrapy project directory.

Confirm that the file exists:

ls -lh books.json

Display the number of extracted records and preview the first three:

python3 -c 'import json; data=json.load(open("books.json")); print(f"Total records: {len(data)}"); print(json.dumps(data[:3], indent=2, ensure_ascii=False))'

The output should contain book records with:

  • Title
  • Price
  • Availability

A completed crawl with exported records and no proxy authentication errors confirms that Scrapy accepted the NodeMaven proxy configuration.

If the spider returns a 407 error, confirm that:

  • The complete NodeMaven username was copied
  • The password is correct
  • The HTTP port matches the dashboard
  • The environment variables are available to Scrapy
  • Reserved characters in the credentials are URL-encoded

Your NodeMaven proxy is now connected to Scrapy.

Try high-quality proxies for Scrapy for $3.50 and get 750MB of traffic

Try high-quality proxies for Scrapy for $3.50 and get 750MB of traffic

Easy proxy integrations for Python scraping

Use the same NodeMaven gateway and authenticated proxy URL across Scrapy, Python Requests, Selenium, and other Python web-scraping tools. Adjust the integration method to the library while keeping the selected location and session policy in your NodeMaven credentials

Choose premium proxies for Scrapy workflows

Run Scrapy spiders with clean, stable NodeMaven IPs for scalable crawling, location-aware data collection, and persistent sessions

Residential Proxies

Residential Proxies

Real residential IPs with rotating and sticky sessions. A versatile choice for large-scale scraping, regional data collection, and websites that evaluate IP reputation

Recommended for:
Mobile Proxies

Mobile Proxies

Real 4G, 5G, and LTE IPs for mobile-first targets and workflows with stricter IP reputation requirements

Recommended for:
ISP proxies

ISP proxies

Static residential ISP IPs with long sessions, fast response times, and unlimited bandwidth. Use them when a spider needs a stable online identity across repeated crawls

Recommended for:
Not sure which proxy type to choose?

Reviews from our clients and partners

Honest feedback from the people who use and trust NodeMaven

A unique antidetect phone solution built for managing mobile accounts at scale
«NodeMaven works closely with Geelark to support reliable mobile multi-account workflows, tested and proven in daily use».
Cloud phones & multi-account platform built for social media management
«The only high-quality proxy provider we’ve chosen to integrate with. Nodemaven provides clean, stable traffic to power our workflows».
A leading antidetect browser trusted by users around the world
«We recommend NodeMaven as the #1 proxy service for multi-accounting. 
It integrates closely with Dolphin Anty to ensure smooth setup».
The #1 Anti-detect Browser Trusted By 9M+ Users
«NodeMaven delivers reliable, high-quality proxies that integrate seamlessly with AdsPower. Together, we make multi-account management smoother, more stable, and easier to scale».
An all-in-one antid-etect browser built for secure and scalable multi-account management
«NodeMaven provides stable, high-quality proxies that work smoothly, supporting secure and efficient multi-account workflows».
The world's most trusted multi-account management expert
«BitBrowser partners with NodeMaven to create a robust anti-detect environment. Multi-account advertising and social media management can easily mitigate the risk of account locking. Using the NodeMaven security proxy ensures stability and protects local data privacy. Clean, high-quality, and stable. We recommend NodeMaven».
Anti-detect browser and cloud phone platform for secure multi-account management at scale
«NodeMaven is the proxy provider our users recommend most in our community. It delivers high-quality, stable IPs that matter most for multi-account professionals who need reliability at scale».

Frequently asked questions

A Scrapy proxy routes crawler requests through another IP address. Scrapy’s HttpProxyMiddleware accepts a proxy URL from request.meta["proxy"] or the http_proxy and https_proxy environment variables.

Generate an HTTP proxy in NodeMaven, keep the complete username and password in environment variables, and use downloader middleware to assign the authenticated URL to request.meta["proxy"]. Scrapy’s built-in HttpProxyMiddleware handles the connection.

Select Rotating as the session type in NodeMaven Proxy Setup. Scrapy keeps using one NodeMaven gateway URL, while NodeMaven manages the exit-IP rotation. This avoids maintaining a separate public proxy list.

Use rotating sessions for broad crawling and IP diversity. Use sticky sessions for cookies, logins, carts, pagination flows, and other multi-request processes that require the same IP.

Select United States in NodeMaven Proxy Setup, choose a rotating residential or mobile session, and copy the complete generated username into the integration. Scale Scrapy concurrency gradually, respect the target’s rules, monitor response codes, and use download delays or AutoThrottle where appropriate.

Yes. An HTTP proxy URL can be used for both HTTP and HTTPS destination URLs. This guide therefore uses http:// at the beginning of the NodeMaven proxy URL even when the spider visits an https:// page.

SOCKS5 support depends on the active Scrapy download handler. Current Scrapy documentation states that HttpxDownloadHandler supports SOCKS proxies while the other built-in handlers do not. For the standard setup in this guide, use NodeMaven HTTP proxies. Treat SOCKS5 as an advanced configuration and verify handler compatibility before deployment.

Downloader middleware can modify requests before they reach the downloader. In this integration, NodeMavenProxyMiddleware sets request.meta["proxy"], and Scrapy’s built-in HttpProxyMiddleware applies that proxy to the network request.

Yes. Set the proxy URL directly on that request:

yield scrapy.Request(

   url="https://example.com/",

   meta={"proxy": proxy_url},

)

A per-request value takes precedence over proxy environment variables. The middleware example uses setdefault so an explicitly assigned request proxy is preserved.

HTTP 407 means proxy authentication failed. Confirm that the username is complete, the password and HTTP port are correct, reserved characters are URL-encoded, and the environment variables are available to the process running Scrapy.

Store credentials in environment variables or a secrets manager. Do not paste them into settings.py, middlewares.py, screenshots, logs, or a committed .env file. Commit only variable names and example placeholders.

Yes. The same NodeMaven gateway credentials can be integrated with Python Requests, Scrapy, and Selenium. Each tool has its own proxy configuration syntax, so reuse the connection details rather than copying Scrapy-specific middleware code into another library.

NodeMaven provides residential, mobile, and ISP proxies, geographic targeting, rotating and sticky sessions, HTTP and SOCKS5 endpoints, and IP Quality Filter options. This lets developers match proxy behavior to each spider without maintaining an unreliable public proxy pool.

Scrapy sends requests through the NodeMaven gateway, while NodeMaven manages the exit IP. Select a Rotating session to change IPs automatically or a Sticky session to keep the same IP.

No. NodeMaven provides rotation through one gateway, so a separate proxy-rotation package is unnecessary. Tools such as scrapy-rotating-proxies are mainly intended for managing and testing a list of separate proxy servers.

Buy proxy server for Scrapy for $3.50 and get 750MB of bandwidth

Start using high-quality proxies today
This site uses cookies to enhance your experience. By continuing, you agree to our use of cookies.