Questions tagged [wreq]

Haskell library for client-side HTTP requests, focused on ease of use.

20 questions
6
votes
1 answer

Haskell / Wreq - Advice on complicated type signatures for http requests

I'm a Haskell beginner and am currently using wreq to make a simple wrapper around an api. I want to send an if-modified-since header if provided with a time. I am doing so in the following manner. getResponse :: (FormatTime t, Exception e) =>…
Nick Acosta
  • 1,890
  • 17
  • 19
3
votes
2 answers

Haskell Wreq - Couldn't match expected type ‘GHC.Exts.Item a0’

I'm experiencing a type error when I run the following code: runPost :: IO String runPost = do res <- post "http://httpbin.org/post" ["num" := (31337 :: Int)] return $ show res The error is the following: • Couldn't match expected type…
Emanegux
  • 1,092
  • 2
  • 20
  • 38
3
votes
1 answer

How to send a PUT request with wreq?

Here is how I would expect to be able to send a PUT request with wreq: {-# LANGUAGE OverloadedStrings #-} import Network.Wreq main = put "http://httpbin.org/put" ["foo":=(1::Int)] However, this gives the following error: HttpExceptionRequest…
tckmn
  • 57,719
  • 27
  • 114
  • 156
3
votes
1 answer

Haskell: How to test a Spock app that uses wreq?

I've written a very simple app in Haskell using Spock and wreq. I want to write some tests, but I'm not sure how to do it. All the app does is make an HTTP request to another server and translate the JSON response into a human-friendly message.…
Jesse Shieh
  • 4,660
  • 5
  • 34
  • 49
3
votes
1 answer

error installing package wreq in cygwin

im trying to install wreq package in cygwin and getting following error: $ cabal install wreq Resolving dependencies... Configuring wreq-0.5.2.1... Building wreq-0.5.2.1... Failed to install wreq-0.5.2.1 Build log (…
nzaroma
  • 100
  • 8
2
votes
1 answer

Is postWith switching my request's Content-Type?

No matter what value I enter as my request's "Content-Type", the outgoing request I send out seems to replace it with "application/x-www-form-urlencoded". The application I'm trying to hit expects "application/json". My code, basically, is…
mttpgn
  • 327
  • 6
  • 17
2
votes
1 answer

Creating an Aeson model from two wreq API calls

I'm looking to solve a problem where I construct some data from a HTTP call and then based off that data I make another HTTP call and enrich the original data with information from the second call. I have code which takes a Spotify Recently Played…
2
votes
0 answers

stack install cause error "cannot satisfy -package-id ..."

I'm using the latest Haskell Platform 8.2.2 on my MacOS El Captain. When I create a new project and install wreq, I will get the following error stack new hello cd hello stack build // <- this is fine stack install wreq // <- this command will cause…
Leo Zhang
  • 3,040
  • 3
  • 24
  • 38
2
votes
1 answer

How should I create a data structure from multiple network requests in Haskell

I'm new to Haskell so apologies in advance for the potentially stupid question. I'd like to build a data structure that is constructed from two http requests in my application. My first request gets a basic list of users which I could choose to…
eddiec
  • 7,608
  • 5
  • 34
  • 36
2
votes
1 answer

haskell wreq param list

In the excellent wreq Haskell library it is easy to add one or more query parameters to an URL: opts = defaults & param "key" .~ ["value"] however what I'm struggling to do is adding a list of parameters at a time: params = [("key1", "value1"),…
1
vote
0 answers

passing a correct encrypted bytestring that works in python doesn't work in Haskell

I'm trying to do a GET request to an API with the specified headers and even though all the headers are right and exactly the same as the working python code but I get an error saying on of the header is not correct. This is the working python…
1
vote
1 answer

How do I set a HTTP header for a request with wreq?

I see there is a likely function to do this of getWith which passes an Option value. However looking up Option type seems to show something with very little info in haddock: How can I set these?
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
1
vote
1 answer

wreq how to combine file upload with post form fields?

How can I combine Part with [(ByteString, ByteString)] (ordinary form input)? partFile :: Text -> FilePath -> Part They're both part of the Postable typeclass…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
1
vote
1 answer

How do I set the HTTP request body with Wreq?

How can I set the request body when using customMethod https://hackage.haskell.org/package/wreq-0.5.2.1/docs/Network-Wreq.html#v:customMethod? post, put etc accept a parameter for the body, however there is no such parameter for customMethod.
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
0
votes
1 answer

How to call multiple API in Haskell using Wreq?

I'm trying to get used to wreq in Haskell with an exercice. Basically, I'm calling a first API that returns me a list of ID, and then I would like to call the API that returns the object from the ID. My code looks like this getAllIds :: IO…
Kadabra
  • 1
  • 1
1
2