Skip to content

Instantly share code, notes, and snippets.

@starrify
Created November 10, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starrify/98ab313c64ce2e2926e94d8d178b9f70 to your computer and use it in GitHub Desktop.
Save starrify/98ab313c64ce2e2926e94d8d178b9f70 to your computer and use it in GitHub Desktop.
$ cat > test.py
# coding: utf8
import scrapy
class TestSpider(scrapy.Spider):
name = 'test'
start_urls = ['http://httpbin.org/get']
def parse(self, response):
yield scrapy.Request('http://httpbin.org/get?foo=bar')
return {'url': response.url}
$ scrapy runspider test.py
2018-11-10 17:09:27 [scrapy.utils.log] INFO: Scrapy 1.5.1 started (bot: scrapybot)
2018-11-10 17:09:27 [scrapy.utils.log] INFO: Versions: lxml 4.2.5.0, libxml2 2.9.8, cssselect 1.0.3, parsel 1.5.1, w3lib 1.19.0, Twisted 18.9.0, Python 3.7.1 (default, Oct 22 2018, 10:41:28) - [GCC 8.2.1 20180831], pyOpenSSL 18.0.0 (OpenSSL 1.1.1 11 Sep 2018), cryptography 2.3.1, Platform Linux-4.18.16-arch1-1-ARCH-x86_64-with-arch
2018-11-10 17:09:27 [scrapy.crawler] INFO: Overridden settings: {'EDITOR': 'vim', 'SPIDER_LOADER_WARN_ONLY': True}
2018-11-10 17:09:27 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
'scrapy.extensions.telnet.TelnetConsole',
'scrapy.extensions.memusage.MemoryUsage',
'scrapy.extensions.logstats.LogStats']
2018-11-10 17:09:27 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
'scrapy.downloadermiddlewares.retry.RetryMiddleware',
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
'scrapy.downloadermiddlewares.stats.DownloaderStats']
2018-11-10 17:09:27 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
'scrapy.spidermiddlewares.referer.RefererMiddleware',
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
'scrapy.spidermiddlewares.depth.DepthMiddleware']
2018-11-10 17:09:27 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2018-11-10 17:09:27 [scrapy.core.engine] INFO: Spider opened
2018-11-10 17:09:27 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2018-11-10 17:09:27 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6024
2018-11-10 17:09:27 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://httpbin.org/get> (referer: None)
2018-11-10 17:09:27 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://httpbin.org/get?foo=bar> (referer: http://httpbin.org/get)
2018-11-10 17:09:27 [scrapy.dupefilters] DEBUG: Filtered duplicate request: <GET http://httpbin.org/get?foo=bar> - no more duplicates will be shown (see DUPEFILTER_DEBUG to show all duplicates)
2018-11-10 17:09:27 [scrapy.core.engine] INFO: Closing spider (finished)
2018-11-10 17:09:27 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 473,
'downloader/request_count': 2,
'downloader/request_method_count/GET': 2,
'downloader/response_bytes': 1212,
'downloader/response_count': 2,
'downloader/response_status_count/200': 2,
'dupefilter/filtered': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2018, 11, 10, 17, 9, 27, 991391),
'log_count/DEBUG': 4,
'log_count/INFO': 7,
'memusage/max': 54579200,
'memusage/startup': 54579200,
'request_depth_max': 2,
'response_received_count': 2,
'scheduler/dequeued': 2,
'scheduler/dequeued/memory': 2,
'scheduler/enqueued': 2,
'scheduler/enqueued/memory': 2,
'start_time': datetime.datetime(2018, 11, 10, 17, 9, 27, 372780)}
2018-11-10 17:09:27 [scrapy.core.engine] INFO: Spider closed (finished)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment