[TIL]FastAPI + Scrapy

강슬기·2021년 12월 14일
0

TIL

목록 보기
9/9

비동기 프레임워크인 FastAPI에서 Scrapy를 결합한 서비스를 개발할 때 연동시
Crawler를 동작시키고 나면 서버가 멈추는 문제가 발생.
그걸 일단 해결한 방법과 차후 자세히 알아보기 위한 자료들 정리.

Scrapy

Event-driven networking

Deferreds에 대해 알아보자
https://twistedmatrix.com/documents/current/core/howto/defer-intro.html

asyncio 지원

문서를 따라 해봤지만 안 됨.다시 해봐야 겠음.
https://docs.scrapy.org/en/latest/topics/asyncio.html

crochet

FastAPI내 processpoolexecutor를 생성하여 crochet으로 wrapping된 Task를 호출.

방법이 맞는지는 확인이 필요!
https://github.com/itamarst/crochet https://github.com/rmax/scrapydo
profile
구르는돌

1개의 댓글

comment-user-thumbnail
2022년 2월 25일

슬기님... 해결하셨나요... 저도 같은 문제에 봉착해 있습니다...

답글 달기