Skip to content


Request is used for operating web requests. It returns a Response object.


Core arguments

  • url: the resource link
  • method: request method, shoud be GET or `POST
  • callback: callback function
  • encoding: html encode
  • headers: request headers
  • metadata: some data that need pass to next request
  • request_config: the configure of the request
  • request_session: aiohttp.ClientSession
  • kwargs: other arguments for request


From the arguments above, we can see that Request can be used both associated with Spider and standalone.

import asyncio

from ruia import Request

request = Request("")
response = asyncio.get_event_loop().run_until_complete(request.fetch())

# Output
# [2018-07-25 11:23:42,620]-Request-INFO  <GET:>
# <Response url[text]: status:200 metadata:{}>

How It Works?

Request class will send asynchronous http request by packaging aiohttp and pyppeteer.