Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Web Scraping

You're reading from   Python Web Scraping Hands-on data scraping and crawling using PyQT, Selnium, HTML and Python

Arrow left icon
Product type Paperback
Published in May 2017
Publisher
ISBN-13 9781786462589
Length 220 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Katharine Jarmul Katharine Jarmul
Author Profile Icon Katharine Jarmul
Katharine Jarmul
Arrow right icon
View More author details
Toc

Starting a project

Now that Scrapy is installed, we can run the startproject command to generate the default structure for our first Scrapy project.

To do this, open the terminal and navigate to the directory where you want to store your Scrapy project, and then run scrapy startproject <project name>. Here, we will use example for the project name:

$ scrapy startproject example
$ cd example

Here are the files generated by the scrapy command:

    scrapy.cfg 
example/
__init__.py
items.py
middlewares.py
pipelines.py
settings.py
spiders/
__init__.py

The important files for this chapter (and in general for Scrapy use) are as follows:

  • items.py: This file defines a model of the fields that will be scraped
  • settings.py: This file defines settings, such as the user agent and crawl delay
  • spiders/: The actual scraping and crawling code are stored...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime