Skip to content

How can I delay requests with HttpCrawler? #1663

Answered by viconx98
viconx98 asked this question in Q&A
Discussion options

You must be logged in to vote

Leaving my final solution here if anyone wants to implement a similar flow.

I gave up on trying to make it work with HttpCrawler or BasicCrawler + sendRequest.

I re-wrote my script to use BasicCrawler and now it makes requests using Axios instead of sendRequest. It seems to have resolved the problem and lets me wait as long as I want right inside the requestHandler. Tested with a 30 minute delay between requests and there were no issues.

Here is a simple example.

// routes.ts
import axios from "axios"
import { createBasicRouter, sleep } from "crawlee"

const axiosClient = axios.create({
    baseURL: "https://jsonplaceholder.typicode.com",
})

export const basicRouter = createBasicRouter()
b…

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
14 replies
@B4nan
Comment options

@viconx98
Comment options

@B4nan
Comment options

@viconx98
Comment options

@viconx98
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by viconx98
Comment options

You must be logged in to vote
1 reply
@viconx98
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants