Questions tagged [httpoison]

for questions related to the HTTP client for Elixir

Yet Another HTTP client for Elixir powered by hackney

https://hex.pm/packages/httpoison


Maintainers

Eduardo Gurgel Pinho

Links

License

MIT

60 questions
9
votes
2 answers

How to add a trusted certificate to HTTPPoison/hackney?

When I try: HTTPoison.get! "https://facebook.com" I get: ** (HTTPoison.Error) {:tls_alert, 'unknown ca'} [error] SSL: :certify: ssl_handshake.erl:1606:Fatal error: unknown ca (httpoison) lib/httpoison.ex:66: HTTPoison.request!/5 which is kind…
diogovk
  • 2,108
  • 2
  • 19
  • 24
6
votes
1 answer

HTTPoison to make a post request with Authorization in header.

I am trying to make a http post request with HTTPoison. I want to pass json data with header, which contains "Authorization": Bearer #{token}. In order to achieve that, I have tried, headers = [{"Authorization": "Bearer #{token}"}, {"Content-Type",…
D.R
  • 829
  • 4
  • 16
  • 30
5
votes
1 answer

HTTPoison.request!/5 raises %HTTPoison.Error with weird reason

After upgrading to Elixir 1.10.3, a call to HTTPoison.request!() raised a HTTPoison.Error with id: nil and a reason of {:options, {:sslv3, {:versions, [:"tlsv1.2", :"tlsv1.1", :tlsv1, :sslv3]}}}. What could cause this? All examples I've seen online…
bigblind
  • 12,539
  • 14
  • 68
  • 123
5
votes
1 answer

Get the count of pool

I’m using HTTPoison and Hackney pools: :hackney_pool.child_spec(:start, [checkout_timeout: ..., max_connections: 100]), :hackney_pool.child_spec(:trigger, [checkout_timeout: ..., max_connections: 100]), :hackney_pool.child_spec(:result,…
Orange-Man
  • 150
  • 2
  • 10
4
votes
1 answer

Elixir fetching metadata from shoutcast

I want to make a program which will display currently playing songs from an internet radio stream(SomaFM). I am using HTTPoison library in Elixir. But I am failing to get a response. It just hangs. I am using the following code: HTTPoison.start url…
aeroith
  • 109
  • 3
  • 7
3
votes
2 answers

HTTPoison manually close connection

This is a very simple module that keeps checking the requester's IP. I use backconnect proxies which means that it gets new IP on every http request. defmodule Test do def go() do Enum.each(1..1, fn x -> …
Nema Ga
  • 2,450
  • 4
  • 26
  • 49
3
votes
1 answer

HTTP 1.0 request with HTTPoison

How do I make a HTTP/1.0 request with HTTPoison? I don't know which version it's using, but I'm assuming it's not 1.0 by default. I am integrating with some accounting software called MoneyWorks, and they recommend using HTTP/1.0 if possible to…
Peter Brown
  • 50,956
  • 18
  • 113
  • 146
2
votes
3 answers

HTTPoison request failes on specific machine but works in another machine

Am doing a post with HTTPoison, on one machine everything works well, but in the other the same code, with similar environment parameters. HTTPoison.post!("https://remote_api", "", [{"X-TOKEN", System.get_env("API_TOKEN"}, {"Content-Type",…
Ricoh
  • 39
  • 1
  • 7
2
votes
1 answer

Elixir HTTPoison getting handshake_failure

This is my curl request `curl --insecure --location --request POST 'url' --header 'Content-Type: application/json' --data-raw '{ "client_id": "test" }' This worked fine! Now this is my elixir request HTTPoison.post("url", request, ssl: [verify:…
Vyshnavi
  • 149
  • 2
  • 10
2
votes
1 answer

iex> how to import HTTPoison

I'm new to Elixir. I was hoping it would be similar to Python or R where modules can be downloaded and kept up-to-date without too much effort. I have already created a mix project to use HTTPoison but I really just want to try out HTTPoison from…
AG1
  • 6,648
  • 8
  • 40
  • 57
2
votes
1 answer

Reddit api oauth authentication elixir

I am trying to retrieve the access token. I have managed to make the user authorize my application, now i am trying to retrieve the access token. Here is the reddit oauth2 documentation: https://github.com/reddit-archive/reddit/wiki/oauth2 and here…
2
votes
3 answers

HTTPoison ArgumentError on Phoenix mix task

I have mix task mix fetch.btc on phoenix app (lib/mix/tasks/fetch.btc.ex): defmodule Mix.Tasks.Fetch.Btc do use Mix.Task def run(_args) do res = HTTPoison.get!("https://blockchain.info/ticker") IO.inspect(res) end end When I run mix…
Alexey Egorov
  • 2,221
  • 2
  • 18
  • 21
2
votes
1 answer

Use HTTPoison to initialize a module attribute

I am trying to do initialize a module attribute like this response = HTTPoison.get! url {:ok, response} = Poison.decode(response.body) @attr response I have done it before with a file, something like this: @external_resource file =…
lapinkoira
  • 8,320
  • 9
  • 51
  • 94
2
votes
1 answer

Send HTTPS get requests to same host but different host ips

I would like to send HTTPS requests to the same host but I would like to choose the target IP every time. For example "dig digitalocean.com" shows these IPs: digitalocean.com. 300 IN A 104.16.110.208 digitalocean.com. 300 IN A …
Barna Kovacs
  • 1,226
  • 1
  • 14
  • 35
2
votes
1 answer

httpoison - response body showing garbled text instead of html

If I try: url = "https://www.economist.com/news/finance-and-economics/21727073-economists-struggle-work-out-how-much-free-economy-comes-cost" {:ok, %HTTPoison.Response{status_code: 200, body: body}} = HTTPoison.get(url) IO.binwrite body I see…
tldr
  • 11,924
  • 15
  • 75
  • 120
1
2 3 4