Answer the question
In order to leave comments, you need to log in
How to use https proxy in node.js?
const HttpsProxyAgent = require('https-proxy-agent')
const fetch = require('node-fetch')
const agent = new HttpsProxyAgent({
protocol: 'https',
host: '193.169.188.21',
port: '5836'
})
fetch('https://jsonplaceholder.typicode.com/todos/1', { agent })
.then(response => response.json())
.then(json => console.log(json))
UnhandledPromiseRejectionWarning: FetchError: request to https://jsonplaceholder.typicode.com/todos/1 failed, reason: write EPROTO 22644:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
import requests
import json
proxies = {
'https': 'https://193.169.188.21':5836'
}
resp = requests.get('https://jsonplaceholder.typicode.com/todos/1', proxies=proxies)
print(resp.text)
Answer the question
In order to leave comments, you need to log in
Maybe you should use the axios package?
NPM: https://www.npmjs.com/package/axios
GitHub: https://github.com/axios/axios
Proxy support is available.
I also encountered such a problem, the use of the socks protocol solved the problem. But I haven't been able to fix this error yet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question