
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
Первый
кешбэк
на прокси-рынке
Превращайте использованный трафик в прокси-кредиты
для дальнейшего
использования


Приветственный
подарок на $100+
- Фильтры качества и скорости
- ZIP-таргетинг
- Персональный прокси-эксперт
Эксклюзивная гарантия качества
Получайте $1 каждый раз, когда наш прокси не работает так, как
обещано

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 резидентский, мобильный, или ISP прокси and choose rotating or sticky sessions for different scraping workflows
Начните тестировать высококачественные прокси за $3.50
How to set up NodeMaven proxies in Scrapy
Connect a NodeMaven HTTP proxy to Scrapy using a project-level downloader middleware. В этом примере используется Books to Scrape, a sandbox built for web-scraping practice
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 сначала.

Generate a NodeMaven proxy
Войдите в Личный кабинет NodeMaven и открыть Настройка прокси-сервера. Choose:
- Тип прокси: Residential, Mobile или ISP
- Местоположение: Select the required country, region, city, or ISP
- Сессия: Rotating or Sticky
- Фильтрация Choose the IP quality option for your workflow
- Протокол: HTTP
Выберите Rotating when you want NodeMaven to change the exit IP between requests. This works well for large-scale crawling, price monitoring, and market research.
Выберите 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.

Store your NodeMaven credentials securely
Copy the complete proxy username and password из личного кабинета NodeMaven.
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; echoPaste the complete username and press Войти. The pasted value will remain hidden.
Enter your proxy password:
read -s -p "NodeMaven proxy password: " NODEMAVEN_PROXY_PASS; echoPaste the password and press Войти. It will also remain hidden.
Export both variables so Scrapy can access them:
export NODEMAVEN_PROXY_USER NODEMAVEN_PROXY_PASSConfirm 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
Важно: The variables remain available only in the current terminal session. If you close the terminal, enter them again before running the spider.

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.pyMove 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)
Важно: The method must be written as __init__, with two underscores before and after инит.
Save and close the file:
- Нажмите Ctrl + O.
- Нажмите Войти to confirm the filename.
- Нажмите Контрол + Икс.
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: passedThe 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.

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.pyLook for this existing setting:
ROBOTSTXT_OBEY = TrueIf 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:
- Нажмите Ctrl + O.
- Нажмите Войти to confirm the filename.
- Нажмите Контрол + Икс.
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.

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.pyNano will display the basic spider created in Step 1.
Remove the existing code:
- Move the cursor to the first line.
- Нажмите 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:
- Нажмите Ctrl + O.
- Нажмите Войти to confirm the filename.
- Нажмите Контрол + Икс.
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 listThe terminal should display:
Spider syntax check: passedbooks
This example spider opens Books to Scrape and extracts each book’s:
- Заголовок
- Цена
- наличие
Мы используем 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: Зона books.py file showing the example URL and the selectors for title, price, and availability, together with the Spider syntax check: passed confirmation.

Run the spider through NodeMaven
From the Scrapy project directory, run:
scrapy crawl books -O books.jsonЗона -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:
- Ан HTTP 200 response
- Extracted book items in the logs
- No proxy connection errors
- Нет 407 Требуется аутентификация прокси ошибка
- A Spider closed (finished) сообщение
- A books.json file in the project directory

Check the Scrapy output
The crawl creates books.json inside the Scrapy project directory.
Confirm that the file exists:
ls -lh books.jsonDisplay 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:
- Заголовок
- Цена
- наличие
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
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












Выберите premium proxies for Scrapy workflows
Run Scrapy spiders with clean, stable NodeMaven IPs for scalable crawling, location-aware data collection, and persistent sessions
Резидентские прокси
Real residential IPs with rotating and sticky sessions. A versatile choice for large-scale scraping, regional data collection, and websites that evaluate IP reputation
Мобильные прокси
Real 4G, 5G, and LTE IPs for mobile-first targets and workflows with stricter IP reputation requirements
ISP прокси
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
Отзывы наших клиентов и партнёров
Честная обратная связь от тех, кто пользуется NodeMaven и доверяет нам




Часто задаваемые вопросы
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.
Использование ротируемые сессии 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.
Выберите США 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

Другие наши прокси-решения
Изучите типы прокси и варианты цен, чтобы выбрать оптимальное решение для вашей задачи




