0
votes

Julia noob, and just trying a few simple exercises.

I'm trying to run the following code:

using HTTP
url = "https://finance.yahoo.com/quote/googl"
r = HTTP.request("GET", url)

and getting a timeout error.

A few comments:

  • I am behind a corporate proxy. I have set http_proxy and https_proxy (and their capitalized equivalents), and I have made the .gitconfig file aware of these settings.
  • No problems with the equivalent code using Python urllib2.
  • Tried http version of the URL--no luck.
  • Tried POST instead of GET--still no luck.
  • Verbose option did not reveal any extra info.

This is the top of the stack trace:

ERROR: LoadError: IOError: connect: connection timed out (ETIMEDOUT)
Stacktrace:
1 try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196
[2] wait() at ./event.jl:255
[3] wait(::Condition) at ./event.jl:46
[4] stream_wait(::Sockets.TCPSocket, ::Condition) at ./stream.jl:47
[5] wait_connected(::Sockets.TCPSocket) at ./stream.jl:263
[6] connect at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Sockets/src/Sockets. jl:444 [inlined]
[7] connect(::Sockets.IPv4, ::UInt64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib /v1.0/Sockets/src/Sockets.jl:428
[8] #getconnection#14(::Bool, ::Int64, ::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Sy mbol},NamedTuple{(:require_ssl_verification, :iofunction),Tuple{Bool,Nothing}}}, ::Function, ::Type{Socket s.TCPSocket}, ::SubString{String}, ::String) at /home/T2213331/.julia/packages/HTTP/nUK4f/src/ConnectionPo ol.jl:548

Per this SO question I have confirmed that ENV["http_proxy"] and ENV["https_proxy"] are both correctly set.

1

1 Answers

2
votes

This seems to work

HTTP.get("https://finance.yahoo.com/quote/googl", proxy="http://123.123.123.123:8888")

Of course you need to provide a correct proxy IP and port.