Closed Billy2011 closed 4 years ago
Please read docs of https://github.com/sindresorhus/got/blob/master/readme.md, hooman is a wrapper around got.
hooman(url, {
headers: {
'user-agent': 'my_user_agent'
}
});
I've tried it, but it doesn't work:
const got = require("hooman");
const url = "http://example.com";
const cookie = "myCookie=myValue";
const agent = "My-User-Agent";
got(url, {
header: {
'User-Agent': agent,
'Cookie': cookie
}
})
.then(response => {
console.log('Header--->>>', response.request.options.headers)
})
.catch(error => {
console.error(error);
});
Header--->>> {
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36',
'cache-control': 'max-age=0',
'upgrade-insecure-requests': '1',
'accept-encoding': 'gzip, deflate, br',
origin: 'http://example.com',
referer: 'http://example.com/'
}
It's not header
, it's headers
. Please triple check your spelling.
What a shit, it's hard to recognize your own mistakes, I'm sorry;)
No problem.
What would you like to discuss?
I want to use
hooman
with Python. Unfortunately I have little experience with JS and at the moment, I don't think it is possible to pass header (user agent, cookie, ...) tohooman
. It would be nice if that were possible in the future.Checklist