Scrapy https教程

2024-09-30 18:28:34 发布

您现在位置:Python中文网/ 问答频道 /正文

所有人!你知道吗

我是新来的刮擦框架。我需要分析一下wisemapping.com网站. 起初,我阅读了官方的Scrapy教程,并试图访问其中一个“wisemap”,但出现了一个错误:

[scrapy.core.engine] DEBUG: Crawled (404) <GET https://app.wisemapping.com/robots.txt> (referer: None)

[scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying
<GET https://app.wisemapping.com/c/maps/576786/public> (failed 3 times): 500 Internal Server Error

[scrapy.core.engine] DEBUG: Crawled (500) <GET https://app.wisemapping.com/c/maps/576786/public> (referer: None)

[scrapy.spidermiddlewares.httperror] INFO: Ignoring response <500 https://app.wisemapping.com/c/maps/576786/public>: HTTP status code is not handled or not allowed

请给我一个建议,用以下代码解决问题:

import scrapy

class QuotesSpider(scrapy.Spider):
    name = "quotes"

    def start_requests(self):
        urls = [
            'https://app.wisemapping.com/c/maps/576786/public',
        ]
        for url in urls:
            yield scrapy.Request(url=url, callback=self.parse)

    def parse(self, response):
        page = response.url.split("/")[-2]
        filename = 'wisemape.html'
        with open(filename, 'wb') as f:
            f.write(response.body)
        self.log('Saved file %s' % filename)

Tags: httpscoredebugselfcomappurlget
1条回答
网友
1楼 · 发布于 2024-09-30 18:28:34

导航到https://app.wisemapping.com/c/maps/576786/public会出现错误 “滚开!!。这张地图已经没有了。 您没有足够的权限查看此地图。此映射已更改为私有或已删除。“

这张地图存在吗?如果是这样,试着公开。你知道吗

如果您知道您尝试访问的地图确实存在,请验证您尝试访问的URL是否正确。你知道吗

相关问题 更多 >