KH8      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~NoneSafe  NoneNone-       (c) 2014 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone !"+-35IN mA session that spans multiple requests. This is responsible for cookie management and TCP connection reuse.DA function that runs a request and returns the associated response.(A request that is ready to be submitted.An element of a Link header.The error type used by   and  ; if a failure occurs when parsing a response body as JSON.A key/value pair for an !application/x-www-form-urlencoded POST request body.TA type that can be rendered as the value portion of a key/value pair for use in an !application/x-www-form-urlencoded' POST body. Intended for use with the  type.The instances for  , strict  , and lazy  7 are all encoded using UTF-8 before being URL-encoded.The instance for  gives an empty string on 4, and otherwise uses the contained type's instance.Render the given value.;A product type for representing more complex payload types. 8A type that can be converted into a PUT request payload.!RRepresent a value in the request body (and perhaps the headers) of a PUT request."9A type that can be converted into a POST request payload.#SRepresent a value in the request body (and perhaps the headers) of a POST request.%AWS request signing version 4&Supported authentication types.Do not use HTTP authentication unless you are using TLS encryption. These authentication tokens can easily be captured and reused by an attacker if transmitted in the clear.'FBasic authentication. This consists of a plain username and password.(gAn OAuth2 bearer token. This is treated by many services as the equivalent of a username and password.)A not-quite-standard OAuth2 bearer token (that seems to be used only by GitHub). This is treated by whoever accepts it as the equivalent of a username and password.*>Amazon Web Services request signing AWSAuthVersion key secret+HOAuth1 request signing OAuth1 consumerToken consumerSecret token secret,ZA function that checks the result of a HTTP request and potentially returns an exception.-!Options for configuring a client./Either configuration for a , or an actual .If only & are provided, then by default a new " will be created for each request.Note#: when issuing HTTP requests using --based functions from the the Network.Wreq.Session module (, %, etc.), this field will be ignored.'An example of using a specific manager: import Network.HTTP.Client ()  $ \mgr -> do let opts =  { / = Right mgr }  opts "http://httpbin.org/get" ;An example of changing settings (this will use a separate U for every request, so make sense only if you're issuing a tiny handful of requets): import Network.HTTP.Client () let settings = % { managerConnCount = 5 } opts =  { / = Left settings }  opts "http://httpbin.org/get" 0.Host name and port for a proxy to use, if any.1Authentication information.Example (note the use of TLS):  let opts =  { 1 =  "user" "pass" } 2 opts "https://httpbin.org/basic-auth/user/pass" 2-Additional headers to send with each request.  let opts =  { 2 = [("Accept", "*/*")] }  opts "http://httpbin.org/get" 3LKey-value pairs to assemble into a query string to add to the end of a URL.For example, given:  let opts = 7 { params = [("sort", "ascending"), ("key", "name")] }  opts "http://httpbin.org/get" %This will generate a URL of the form: .http://httpbin.org/get?sort=ascending&key=name4[The maximum number of HTTP redirects to follow before giving up and throwing an exception.In this example, a  will be thrown with a P constructor, because the maximum number of redirects allowed will be exceeded:  let opts =  { 4 = 3 } ' opts "http://httpbin.org/redirect/5" 5%Cookies to set when issuing requests.Note#: when issuing HTTP requests using --based functions from the the Network.Wreq.Session module (, /, etc.), this field will be used only for the first% HTTP request to be issued during a D. Any changes changes made for subsequent requests will be ignored.6KFunction that checks the status code and potentially returns an exception.This defaults to &, which will just use the default of  which throws a StatusException if the status is not 2XX.7A MIME content type, e.g. "application/octet-stream".8)Return the URL associated with the given .SThis includes the port number if not standard, and the query string if one exists.< !"#$%&'()*+,-./0123456787 !"#$%&'()*+,-./012345678 !"#$%&'()*+,- ./012345678NoneIN;Set a header to the given value, replacing any prior value.MSet a header to the given value, but only if the header was not already set.999None(c) 2014 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone35$   ' !"#$%&'()*+,-./012345678'-./0123456&'()*+$%,"# !78$   None    None4IN+ !"#$%&'()*+,-./0123456789:;<=>1 - !"#$%&'()*+,-./0123456789:<=>+ !"#$%&'()*+,-./0123456789:;<=>(c) 2014 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNoneIN*:YA lens onto configuration of the connection manager provided by the http-client package.RIn this example, we enable the use of OpenSSL for (hopefully) secure connections: import OpenSSL.Session ( ) import Network.HTTP.Client.OpenSSL let opts =    : ! Left ("# ) "$ $ ! opts "https://httpbin.org/get" HIn this example, we also set the response timeout to 10000 microseconds: import OpenSSL.Session ( ) import Network.HTTP.Client.OpenSSL import Network.HTTP.Client (, %) let opts =    : ! Left ("# )   : ! Left ( { % = Just 10000 } ) "$ $ ! opts "https://httpbin.org/get" ; A lens onto proxy configuration.Example:  let opts =    ; & ' "localhost" 8000  opts "http://httpbin.org/get" Note here the use of the & setter to turn a  into a  3, to make the type of the RHS compatible with the () lens.<#A lens onto request authentication.Example (note the use of TLS):  let opts =    (* &  "user" "pass" 2 opts "https://httpbin.org/basic-auth/user/pass" =VA lens onto all headers with the given name (there can legitimately be zero or more).Example:  let opts =    = "Accept" ! ["*/*"]  opts "http://httpbin.org/get" >AA lens onto all headers (there can legitimately be zero or more).NIn this example, we print all the headers sent by default with every request. print ( + >) ?_A lens onto all query parameters with the given name (there can legitimately be zero or more)..In this example, we construct the query URL "'http://httpbin.org/get?foo=bar&foo=quux".  let opts =    ? "foo" ! ["bar", "quux"]  opts "http://httpbin.org/get" @!A lens onto all query parameters.AaA lens onto the maximum number of redirects that will be followed before an exception is thrown.In this example, a  will be thrown with a P constructor, because the maximum number of redirects allowed will be exceeded.  let opts =    A ! 3 ' opts "http://httpbin.org/redirect/5" B0A lens to get the optional status check functionC?A traversal onto the cookie with the given name, if one exists.N.B. This is an "illegal" ?: we can change the E of the associated = so that it differs from the name provided to this function.DA lens onto all cookies.E!A lens onto the name of a cookie.F"A lens onto the value of a cookie.G(A lens onto the expiry time of a cookie.H#A lens onto the domain of a cookie.I!A lens onto the path of a cookie.J*A lens onto the creation time of a cookie.K-A lens onto the last access time of a cookie.L`A lens onto whether a cookie is persistent across sessions (also known as a "tracking cookie").M*A lens onto whether a cookie is host-only.NVA lens onto whether a cookie is secure-only, such that it will only be used over TLS.O,A lens onto whether a cookie is "HTTP-only".Such cookies should be used only by browsers when transmitting HTTP requests. They must be unavailable in non-browser environments, such as when executing JavaScript scripts.P:A lens onto the hostname portion of a proxy configuration.Q9A lens onto the TCP port number of a proxy configuration.R+A lens onto the status of an HTTP response.S,A lens onto the version of an HTTP response.T;A lens onto all matching named headers in an HTTP response.cTo access exactly one header (the result will be the empty string if there is no match), use the (+ ) operator. r <- ,# "http://httpbin.org/get" print (r + T "Content-Type") 1To access at most one header (the result will be " if there is no match), use the (- ) operator. r <- ,# "http://httpbin.org/get" print (r - T "Content-Transfer-Encoding") 9To access all (zero or more) matching headers, use the (. ) operator. r <- ,# "http://httpbin.org/get" print (r . T "Set-Cookie") U,A lens onto all headers in an HTTP response.V A fold over Link5 headers, matching on both parameter name and value.For example, here is a Link* header returned by the GitHub search API. Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next", <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last">And here is an example of how we can retrieve the URL for the next link programatically. r <- ,G "https://api.github.com/search/code?q=addClass+user:mozilla" print (r - V "rel" "next" . \) W#A lens onto the body of a response. r <- ,# "http://httpbin.org/get" print (r + W) X2A fold over any cookies that match the given name. r <- ,$ "http://www.nytimes.com/" print (r - responseCookie "RMID") Y,A lens onto all cookies set in the response.Z5A lens onto the numeric identifier of an HTTP status.[6A lens onto the textual description of an HTTP status.\!A lens onto the URL portion of a Link element.] A lens onto the parameters of a Link element.^A lens onto the name of the  input: element associated with part of a multipart form upload._JA lens onto the filename associated with part of a multipart form upload.`NA lens onto the content-type associated with part of a multipart form upload.a\A lens onto the code that fetches the data associated with part of a multipart form upload.bTurn an attoparsec @ into a A.PBoth headers and bodies can contain complicated data that we may need to parse.Example: when responding to an OPTIONS request, a server may return the list of verbs it supports in any order, up to and including changing the order on every request (which httpbin.org /actually does/!). To deal with this possibility, we parse the list, then sort it.,import Data.Attoparsec.ByteString.Char8 as Aimport Data.List (sort))let comma = skipSpace >> "," >> skipSpace3let verbs = A.takeWhile isAlpha_ascii `sepBy` comma%r <- options "http://httpbin.org/get"2r ^. responseHeader "Allow" . atto verbs . to sort["GET","HEAD","OPTIONS"]c The same as b9, but ensures that the parser consumes the entire input.Equivalent to: c myParser = b (myParser B C) *:;<=>?@ABCDEFGHIJKLMNOPQRSTHeader name to match.UVParameter name to match.Parameter value to match.WXName of cookie to match.YZ[\]^_`abc2 ,-:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc2-:;<=?A>@CD,BPQEFGHIJKLMNOWTVXUYRS Z[\]^_`abc*:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcNone+-04DEFGHIJKLMNOdPQRSefTUVWdeffed D EFGHIJKLMNOdPQRSefTUVW/None!"XgYZ[\]^_`abcdefghijklmnXgZ[\]^efghijklmnXgYZ[\]^_`abcdefghijklmn(c) 2014 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone4hIssue a GET request.Example: h "http://httpbin.org/get" !r <- get "http://httpbin.org/get" r ^. responseStatus . statusCode200j(Issue a GET request, using the supplied -.Example:  let opts = g o ? "foo" p ["bar"] j opts "http://httpbin.org/get" ,let opts = defaults & param "foo" .~ ["bar"]*r <- getWith opts "http://httpbin.org/get"r ^? responseBody . key "url".Just (String "http://httpbin.org/get?foo=bar")kIssue a POST request.Example: k "http://httpbin.org/post" (q [1,2,3]) 4r <- post "http://httpbin.org/post" (toJSON [1,2,3])&r ^? responseBody . key "json" . nth 2Just (Number 3.0)l)Issue a POST request, using the supplied -.Example:  let opts = g o ? "foo" p ["bar"] l! opts "http://httpbin.org/post" (q [1,2,3]) ,let opts = defaults & param "foo" .~ ["bar"]=r <- postWith opts "http://httpbin.org/post" (toJSON [1,2,3])r ^? responseBody . key "url"/Just (String "http://httpbin.org/post?foo=bar")mIssue a HEAD request.Example: m "http://httpbin.org/get" #r <- head_ "http://httpbin.org/get""r ^? responseHeader "Content-Type"Just "application/json"n)Issue a HEAD request, using the supplied -.Example:  let opts = g o ? "foo" p ["bar"] n opts "http://httpbin.org/get" ,let opts = defaults & param "foo" .~ ["bar"]+r <- headWith opts "http://httpbin.org/get" r ^? responseHeader "Connection"Just "keep-alive"oIssue a PUT request.p(Issue a PUT request, using the supplied -.qIssue an OPTIONS request.Example: q "http://httpbin.org/get" See b# for a more complex worked example.r-Issue an OPTIONS request, using the supplied -.Example:  let opts = g o ? "foo" p ["bar"] r opts "http://httpbin.org/get" sIssue a DELETE request.Example: s "http://httpbin.org/delete" 'r <- delete "http://httpbin.org/delete" r ^. responseStatus . statusCode200t+Issue a DELETE request, using the supplied -.Example:  let opts = g o A p 0 t# opts "http://httpbin.org/delete" $let opts = defaults & redirects .~ 00r <- deleteWith opts "http://httpbin.org/delete" r ^. responseStatus . statusCode200uIssue a custom-method request Example:  u% "PATCH" "http://httpbin.org/patch" 4r <- customMethod "PATCH" "http://httpbin.org/patch" r ^. responseStatus . statusCode200v:Issue a custom request method request, using the supplied -.Example:  let opts = g o A p 0 v* "PATCH" opts "http://httpbin.org/patch" $let opts = defaults & redirects .~ 0=r <- customMethodWith "PATCH" opts "http://httpbin.org/patch" r ^. responseStatus . statusCode200w,Issue a custom-method request with a payloadxAIssue a custom-method request with a payload, using the supplied -.{KConvert the body of an HTTP response from JSON to a suitable Haskell type.In this example, we use { in the IO monad, where it will throw a 4 exception if conversion to the desired type fails. ' {-# LANGUAGE DeriveGeneric #-} import  GHC.Generics (01) {- This Haskell type corresponds to the structure of a response body from httpbin.org. -} data GetBody = GetBody { headers :: 23   , args :: 23   , origin ::  , url ::  } deriving (Show, 01) -- Get GHC to derive a r instance for us. instance r GetBody {- The fact that we want a GetBody below will be inferred by our use of the "headers" accessor function. -} foo = do r <- { =<< h. "http://httpbin.org/get" print (headers (r +  responseBody))  If we use { in the s monad, it will return t with a " payload if conversion fails, and u with a  whose  responseBody# is the converted value on success.|4Convert the body of an HTTP response from JSON to a Value.In this example, we use | in the IO monad, where it will throw a  exception if the conversion to Value fails. foo = do r <- | =<< h% "http://httpbin.org/get" print (r -  responseBody& . key "headers" . key "User-Agent") }FBasic authentication. This consists of a plain username and password.Example (note the use of TLS):  let opts = g o < ?~ } "user" "pass" j2 opts "https://httpbin.org/basic-auth/user/pass" Note here the use of the & setter to turn an & into a  &3, to make the type of the RHS compatible with the < lens.5let opts = defaults & auth ?~ basicAuth "user" "pass"<r <- getWith opts "https://httpbin.org/basic-auth/user/pass"'r ^? responseBody . key "authenticated"Just (Bool True)~hOAuth1 authentication. This consists of a consumer token, a consumer secret, a token and a token secretgAn OAuth2 bearer token. This is treated by many services as the equivalent of a username and password.Example (note the use of TLS):  let opts = g o < ?~  "1234abcd" j6 opts "https://public-api.wordpress.com/rest/v1/me/" A not-quite-standard OAuth2 bearer token (that seems to be used only by GitHub). This will be treated by whatever services accept it as the equivalent of a username and password.Example (note the use of TLS):  let opts = g o < ?~  "abcd1234" j% opts "https://api.github.com/user" AWS v4 request signature.Example (note the use of TLS):  let opts = g o < ?~ 'awsAuth AWSv4' "key" "secret" j2 opts "https://dynamodb.us-west-2.amazonaws.com" Proxy configuration.Example:  let opts = g o ; ?~  "localhost" 8000 j opts "http://httpbin.org/get" Note here the use of the & setter to turn a  into a  3, to make the type of the RHS compatible with the ; lens.Make a Part whose content is a strict , encoded as UTF-8.The Part? does not have a file name or content type associated with it.Make a Part whose content is a , encoded as UTF-8.The Part? does not have a file name or content type associated with it.hijklmnopqrstuvwxyz{|} Username. Password.~Consumer tokenConsumer secret OAuth tokenOAuth token secret"Name of the corresponding <input>.The body for this ."Name of the corresponding <input>.The body for this .U $%&-:;<=>?@ABCDEFGHIRTUVWXYZ[\]^_`abcghijklmnopqrstuvwxyz{|}~Uhjklmnqropstuvwxyz-g:=?A>@CDB&$%<}~;i^_`aWTVXUYR Z[\]{|EFGHIbchijklmnopqrstuvwxyz{|}~(c) 2014 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNoneIN Create a *, passing it to the given function. The 5 will no longer be valid after that function returns.MThis session manages cookies and uses default session manager configuration.Create a session.This uses the default session manager settings, but does not manage cookies. It is intended for use with REST-like HTTP-based APIs, which typically do not use cookies.SCreate a session, using the given manager settings. This session manages cookies.BCreate a session, using the given cookie jar and manager settings.-specific version of ,.-specific version of 4.-specific version of 5.-specific version of 6.-specific version of 7.-specific version of 8.-specific version of .-specific version of 9.-specific version of :.-specific version of ;.-specific version of .-specific version of <.vIf 7 is specified, no cookie management will be performed.wxyz99vwxyz{=>?=>@=>A=>B=>C=DE=DF=DF=DGHIJKLMN8OP  Q R S S T U V V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j j k ) * l m n o p q rsk)*tlumnpvowxyz{|}~TU/,495:76;8<  ',456789:;< K=D=D=D        s R  p)     u*polkm)n|zy}w{~xUT ut!v"#$%&'"#()%*+,-./0123456789:;<=>?//@/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/UV "W!XYZXY[\]\^\_`aFbcdwreq_DKzlQxmyHJJ8tji9rapn67 Network.WreqNetwork.Wreq.LensNetwork.Wreq.Cache.StoreNetwork.Wreq.SessionNetwork.Wreq.TypesNetwork.Wreq.CacheNetwork.Wreq.Lens.Machinery Paths_wreqNetwork.Wreq.Internal.OAuth1Network.Wreq.Internal.TypesasJSONasValueData.Text.LazyTextgetWithputWithNetwork.HTTP.Client withManagerdefaultsdefaultManagerSettings basicAuth HttpExceptionTooManyRedirectsSessionNetwork.Wreq.Internal.LensNetwork.Wreq.Internal.AWSNetwork.Wreq.Internal.LinkNetwork.Wreq.Lens.THOpenSSL.Sessioncontext Control.Lens&.~Network.HTTP.Client.OpenSSLopensslManagerSettings withOpenSSLmanagerResponseTimeout?~ httpProxyLensproxyauth^.get^?^..Network.Wreq.Internal GHC.GenericsGenericData.MapMapposthead_optionsputdeletepostWithheadWith optionsWith deleteWithhttpc_Dd5vtR4Jgs84pcolSEHqW9%Network.HTTP.Client.MultipartFormDatapartFileSourcepartFilepartLBSpartBSPartNetwork.HTTP.Client.TypesCookieProxyResponsehttpt_K5bvT12P71qJPccnLMsPeJNetwork.HTTP.Types.StatusStatusStoreemptyinsertlookupfromListtoListRunReqLinklinkURL linkParams JSONError FormParam:= FormValuerenderFormValuePayloadRawPutable putPayloadPostable postPayloadAWSAuthVersionAWSv4Auth BasicAuth OAuth2Bearer OAuth2TokenAWSAuthOAuth1 StatusCheckerOptionsmanagerheadersparams redirectscookies checkStatus ContentTypereqURLseshRunheaderparamcookie cookieName cookieValuecookieExpiryTime cookieDomain cookiePathcookieCreationTimecookieLastAccessTimecookiePersistentcookieHostOnlycookieSecureOnlycookieHttpOnly proxyHost proxyPortresponseStatusresponseVersionresponseHeaderresponseHeaders responseLink responseBodyresponseCookieresponseCookieJar statusCode statusMessagepartName partFileNamepartContentType partGetBodyattoatto_ cacheStore validateEntry shouldCache customMethodcustomMethodWithcustomPayloadMethodcustomPayloadMethodWithfoldGet foldGetWith oauth1Auth oauth2Bearer oauth2TokenawsAuthpartText partString withSessionwithAPISessionwithSessionWithwithSessionControl defaultRules fieldName makeLenses toCamelCasecatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName signRequestcapacitysizeepochpsqEpoch $fShowStorebaseGHC.BaseStringtext_BKzOMwCPkuv5n8xwLM3CQGData.Text.InternalMaybeNothingManagerManagerSettingsRequestBodyNoBody StringBody ReaderBody CacheEntry entryCreated entryExpires entryResponse seshCookies seshManagerMgr$fShowCacheEntry $fShowSession$fExceptionJSONError$fShowFormParam $fShowOptions setHeadermaybeSetHeader cookieJar decompressgetConnectionWrapperhost hostAddressmethodonRequestBodyExceptionpathport queryStringrawBody redirectCount requestBodyrequestHeadersrequestVersionresponseTimeoutsecureassocassoc2 deleteKey signRequestV4 payloadHashserviceAndRegionremoveRunscopepayload$fFormValueMaybe $fFormValue()$fFormValueDouble$fFormValueFloat$fFormValueWord64$fFormValueWord32$fFormValueWord16$fFormValueWord8$fFormValueWord$fFormValueInteger$fFormValueInt64$fFormValueInt32$fFormValueInt16$fFormValueInt8$fFormValueInt$fFormValueByteString$fFormValueByteString0 $fFormValue[]$fFormValueBuilder$fFormValueText$fFormValueText0$fPutableValue$fPutableByteString$fPutableByteString0$fPutablePayload$fPostableValue$fPostableByteString$fPostableByteString0$fPostablePayload$fPostableFormParam $fPostable[] $fPostable(,) $fPostable[]0 $fPostable[]1$fPostablePartQuotLiteral Backslashlinkslink quotedString paramNameresponseClose' partFilename partHeaders _CookieJarlens_03F7YPSHm2sJzAhp4GjDVQControl.Lens.Type Traversal'attop_CHXc2GBC42CCcHQBFIgiox#Data.Attoparsec.ByteString.InternalParserFold<*Data.Attoparsec.Internal endOfInput CacheResponsePublicPrivateNoCacheNoStore NoTransformMustRevalidateProxyRevalidateMaxAgeSMaxAge ExtensionSecondscacheableStatusescacheableMethodspossiblyCacheablecomputeExpirationsimplifyCacheResponseparseCacheResponse parseDate$fHashableCacheResponse setRedirectsemptyMethodWithignoreResponse readResponsefoldResponseBodyrequestrunpreparesetQuerysetAuthsetProxysetCheckStatus prepareGetrunRead preparePost prepareMethodpreparePayloadMethod prepareHead runIgnoreprepareOptions preparePut prepareDelete Data.FunctionControl.Lens.Setteraeson_HlhjT2iot3uC3gQEbzJErCData.Aeson.Types.ClasstoJSONFromJSON Data.EitherEitherLeftRightMappingrunWithstringignore