     [Answers](https://scrapfly.io/blog)   /  [scrapy](https://scrapfly.io/blog/tag/scrapy)   /  [How to pass custom parameters to scrapy spiders?](https://scrapfly.io/blog/answers/how-to-pass-parameters-to-scrapy-spiders-cli)   # How to pass custom parameters to scrapy spiders?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Apr 23, 2023 1 min read [\#scrapy](https://scrapfly.io/blog/tag/scrapy) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli "Share on LinkedIn")    

 

 

To configure scrapy spiders with custom execution parameters scrapy's CLI `-a` option can be used.

Scrapy sets `-a` CLI parameters as scrapy spider instance attributes (e.g. `-a country` -&gt; `self.country`) when the crawl command is called.

For example, here we are passing country and proxy parameters to our scraper:

shell```shell
scrapy crawl myspider -a country=US -a "proxy=http://222.22.33.44:9000"
```



python```python
import scrapy

class MySpider(scrapy.Spider):
    name = "myspider"

    def parse(self, response):
        print(self.country)
        print(self.proxy)
```



This is an easy and useful feature for when specific customization is needed for each scrapy crawl command.

Additionally, the `-s` CLI parameter can be used to set or override any scrapy settings.



 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-pass-parameters-to-scrapy-spiders-cli) 



 ## Related Articles

 [  

 python xpath 

### Web Scraping With Scrapy: The Complete Guide in 2026

Tutorial on web scraping with scrapy and Python through a real world example project. Best practices, extension highligh...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-scrapy) [  

 python headless-browser 

### Web Scraping Dynamic Websites With Scrapy Playwright

Learn about Selenium Playwright. A Scrapy integration that allows web scraping dynamic web pages with Scrapy. We'll expl...

 

 ](https://scrapfly.io/blog/posts/web-scraping-dynamic-websites-with-scrapy-playwright) [  

 python headless-browser 

### Web Scraping Dynamic Web Pages With Scrapy Selenium

Learn how to scrape dynamic web pages with Scrapy Selenium. You will also learn how to use Scrapy Selenium for common sc...

 

 ](https://scrapfly.io/blog/posts/web-scraping-dynamic-web-pages-with-scrapy-selenium) 

  ## Related Questions

- [ Q How to rotate proxies in scrapy spiders? ](https://scrapfly.io/blog/answers/how-to-rotate-proxies-in-scrapy-spiders)
- [ Q How to pass data between scrapy callbacks in Scrapy? ](https://scrapfly.io/blog/answers/how-to-pass-data-between-scrapy-callbacks)
- [ Q How to pass data from start\_requests to parse callbacks in scrapy? ](https://scrapfly.io/blog/answers/how-to-pass-data-from-start-request-to-callbacks-scrapy)
- [ Q How to add headers to every or some scrapy requests? ](https://scrapfly.io/blog/answers/how-to-add-headers-to-every-or-some-scrapy-requests)
 
  



   



 Scale your web scraping effortlessly, **1,000 free credits** [Start Free](https://scrapfly.io/register)