This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.web.server import Site, NOT_DONE_YET | |
from twisted.web.resource import Resource | |
from twisted.internet import reactor, endpoints | |
counter = 0 | |
import time | |
class Home(Resource): | |
isLeaf = True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.web.server import Site, NOT_DONE_YET | |
from twisted.web.resource import Resource | |
from twisted.internet import reactor, endpoints | |
from twisted.internet.task import deferLater | |
def getarg(request, name, default=None, type=None): | |
if name in request.args: | |
value = request.args[name][0] | |
if type is not None: | |
value = type(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.internet import reactor, endpoints | |
from twisted.web.server import Site | |
from twisted.web.static import File | |
from twisted.web.resource import Resource | |
import time | |
import os | |
class Home(Resource): | |
isLeaf = False | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be placed inside scrapy folder | |
git fetch; | |
if git status | grep -q "Your branch is behind 'origin/master'"; then | |
git merge; | |
cd ../scrapy-bench; # Change folder scrapy-bench | |
tox -- bookworm; | |
tox -- xpathbench; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
import datetime | |
from six.moves.urllib.parse import urlparse | |
import click | |
import scrapy | |
from scrapy.http import Request, HtmlResponse | |
from scrapy.linkextractors import LinkExtractor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scrapy.crawler import CrawlerProcess | |
from scrapy.crawler import CrawlerRunner | |
from twisted.internet import reactor | |
from scrapy.utils.project import get_project_settings | |
from scrapy.utils.log import configure_logging | |
process = CrawlerProcess(get_project_settings()) | |
# 'followall' is the name of one of the spiders of the project. | |
#process.crawl('followall') |