Feature request: add proxy support
QiangF opened this issue · comments
Unfortunately Google is blocked in my country. I have followed online tutorials to setup http, https and socks proxy, but I still get this error.
Error: (error http 429)
Sorry, proxy is out of scope of this package. Do you have access to duckduckgo?
I can access these sites via proxy with eww. My local proxy address is
http://127.0.0.1:7890
socks5://127.0.0.1:7891
Perhaps just some configuration changes will make it work. I have tried to set request-curl-options :
(request-curl-options `(,(format "--proxy socks5://127.0.0.1:7891 -A \"%s\"" (howdoyou--get-user-agent))))
Are you referring to this line https://github.com/thanhvg/emacs-howdoyou/blob/master/howdoyou.el#L171?
I think it makes sense, I can add a user setting for curl option. But the change you tried didn't work for you did it? request-curl-options
is a list so it should be like this:
(request-curl-options `("--proxy socks5://127.0.0.1:7891" ,(format "-A \"%s\"" (howdoyou--get-user-agent))))
Also try with curl first to see if the proxy option is correct because it seems to be version dependent. This SO has conflicting suggestions about proxy https://stackoverflow.com/questions/9445489/performing-http-requests-with-curl-using-proxy.
I don't use proxy so there not much help I can provide. I can't image coding without googling. Good luck
One more thing google is also very stingy, they may ban your proxy ip address if their AI is not in a good mood.
I do get a response for the following code :
(setq howdoyou-use-curl nil)
(let ((url-user-agent (howdoyou--get-user-agent)))
(url-retrieve "https://www.google.com"
(lambda (status start-time)
(message "The request is completed in %f seconds"
(float-time (time-subtract nil start-time)))
(display-buffer (current-buffer)))
`(,(current-time))
'silent
'inhibit-cookies))
duckduckgo is not blocked in my country. Perhaps it is less complicated than google.
I guess I have to live with Firefox. Thanks anyway!
Turns out google think the request is sent by a robot.
HTTP/1.1 429 Too Many Requests
Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot. <a href="#" onclick="document.getElementById('infoDiv').style.display='block';">Why did this happen?</a><br><br>