Coder Social home page Coder Social logo

Comments (2)

superniao666 avatar superniao666 commented on August 11, 2024

重写async def process_start_urls(self):这个方法也是同样结果
输出:
[2021:05:30 13:51:58] INFO Ruia Spider started!
[2021:05:30 13:51:58] INFO Ruia Worker started: 140647323043984
[2021:05:30 13:51:58] INFO Ruia Worker started: 140647323044160
[2021:05:30 13:51:58] INFO Request <GET: http://www.httpbin.org/>
[2021:05:30 13:51:58] INFO Request <POST: http://www.httpbin.org/post>
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "/",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "0",
"Content-Type": "application/octet-stream",
"Host": "www.httpbin.org",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37",
"X-Amzn-Trace-Id": "Root=1-60b327ff-c1662cca36b7"
},
"json": null,
"origin": "229.165.62.121",
"url": "http://www.httpbin.org/post"
}

[2021:05:30 13:51:59] INFO Ruia Stopping spider: Ruia
[2021:05:30 13:51:59] INFO Ruia Total requests: 2
[2021:05:30 13:51:59] INFO Ruia Time usage: 0:00:00.897849
[2021:05:30 13:51:59] INFO Ruia Spider finished!

Process finished with exit code 0
找不到请求中的body参数值

from ruia.

howie6879 avatar howie6879 commented on August 11, 2024

用法不对,改动代码如下:

class ScrapedSpider(Spider):
    start_urls = ["http://www.httpbin.org/"]
    concurrency = 5

    async def parse(self, response):
        url = "http://www.httpbin.org/post"

        aiohttp_kwargs = {"data": {"name": "jack"}}
        yield Request(url=url, method="POST", callback=self.parse1, **aiohttp_kwargs)

如下图传递成功:

image

from ruia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.