Problem
Trying to follow the example in ‘Programming Elixir 1.2’ for fetching the issues from Github you are getting the following error:
(issues) lib/issues/github_issues.ex:14: Issues.GithubIssues.handle_response({:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}})
Solution
You are quite likely behind a proxy and you get a timeout. Add the proxy details to the HTTPoison.get request as follows:
iex(4)> HTTPoison.get!( "https://api.github.com/repos/elixir-lang/elixir", [], [{:proxy, "your_proxy_ip:your_proxy_port"}])
And you could make the following change to the github_issues.ex file to be able to work with the proxy:
def fetch(user, project, proxy) do issues_url(user, project) |> HTTPoison.get(@user_agent, proxy) |> handle_response end
So you can call it like the following from iex:
iex(1)> Issues.GithubIssues.fetch("elixir-lang", "elixir", [{:proxy, "your_proxy_ip:your_proxy_port"}])