haskell - WReq add abritrary cookie to the request -
i'm trying use proxmox ve json api, wreq can login , json response containing token sent cookie every request. question how set cookie wreq ? looks session handling automatically handle set-cookie sent server, in case never happens.
is there wreq equivalent simple curl -b "something=value" in shell ? looks possible call cookie constructor hand takes lot of argument, , don't know should put in there besides name , value.
thanks,
one option use getwith
allows specify cookiejar custom cookie values.
{-# language overloadedstrings #-} import network.wreq.lens import network.wreq import control.lens import network.http.client import data.time.clock secs n = n*10^12 mins n = n*60 days n = n*1440 foo = <- getcurrenttime let expires = addutctime (days 30) cookie = cookie "name" "value" expires "example.com" "/" true true false false jar = createcookiejar [cookie] opts = defaults :: options opts' = opts & cookies .~ (just jar) getwith opts' "http://example.com/asd"
Comments
Post a Comment