Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001863E6E2790> #7

Open
yuzhiyizhan opened this issue Jan 3, 2023 · 2 comments

Comments

@yuzhiyizhan
Copy link

image
pixiy.py

# -*- coding: utf-8 -*-
from middlewares import middleware
from asyncpy.spider import Spider
from loguru import logger


class PixivSpider(Spider):
    name = 'pixiv'

    start_urls = []
    cookies = {
        ***
    }
    headers = {
       ***
    }

    async def start_requests(self):
        user_id = list(
            set([12651854, 13926781]))

        for i in user_id:
            url = f'https://www.pixiv.net/ajax/user/{i}/profile/all?lang=zh'
            yield self.request(url=url, callback=self.parse, cookies=self.cookies, meta={'user_id': i}, method="GET",
                               headers=self.headers)
            break

    async def parse(self, response):
        logger.debug(response.text)


PixivSpider.start(middleware=middleware)

大佬你好,我编写上面程序时会报 RuntimeError: Event loop is closed
我的python版本3.8
asyncpy 1.2.0
aiohttp 3.8.1

我不是很会python的异步编程,请大佬指点

@tuhaolam
Copy link

为什么要在yield后面加break,这样就只会执行一次就退出了

@yuzhiyizhan
Copy link
Author

yuzhiyizhan commented May 16, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants