document new genspider behavior

This commit is contained in:
Valdir Stumm Junior 2016-07-05 22:48:18 -03:00
parent 8987b17730
commit 081595a2e4
1 changed files with 11 additions and 22 deletions

View File

@ -159,6 +159,7 @@ settings).
Global commands:
* :command:`startproject`
* :command:`genspider`
* :command:`settings`
* :command:`runspider`
* :command:`shell`
@ -173,7 +174,6 @@ Project-only commands:
* :command:`list`
* :command:`edit`
* :command:`parse`
* :command:`genspider`
* :command:`bench`
.. command:: startproject
@ -197,14 +197,9 @@ genspider
---------
* Syntax: ``scrapy genspider [-t template] <name> <domain>``
* Requires project: *yes*
* Requires project: *no*
Create a new spider in the current project.
This is just a convenience shortcut command for creating spiders based on
pre-defined templates, but certainly not the only way to create spiders. You
can just create the spider source code files yourself, instead of using this
command.
Create a new spider in the current folder or in the current project's ``spiders`` folder, if called from inside a project. The ``<name>`` parameter is set as the spider's ``name``, while ``<domain>`` is used to generate the ``allowed_domains`` and ``start_urls`` spider's attributes.
Usage example::
@ -215,22 +210,16 @@ Usage example::
csvfeed
xmlfeed
$ scrapy genspider -d basic
import scrapy
$ scrapy genspider example example.com
Created spider 'example' using template 'basic'
class $classname(scrapy.Spider):
name = "$name"
allowed_domains = ["$domain"]
start_urls = (
'http://www.$domain/',
)
$ scrapy genspider -t crawl scrapyorg scrapy.org
Created spider 'scrapyorg' using template 'crawl'
def parse(self, response):
pass
$ scrapy genspider -t basic example example.com
Created spider 'example' using template 'basic' in module:
mybot.spiders.example
This is just a convenience shortcut command for creating spiders based on
pre-defined templates, but certainly not the only way to create spiders. You
can just create the spider source code files yourself, instead of using this
command.
.. command:: crawl