Have you taken a look at net/url 
<https://docs.racket-lang.org/net/url.html?q=net%2Furl>? From there, I see:

   - make-http-connection 
   
<https://docs.racket-lang.org/net/url.html?q=net%2Furl#%28def._%28%28lib._net%2Furl..rkt%29._make-http-connection%29%29>,
 
   which can allow calls to get-pure-port/headers to stay connected if the 
   server allows it.
   - current-proxy-servers 
   
<https://docs.racket-lang.org/net/url.html?q=net%2Furl#%28def._%28%28lib._net%2Furl..rkt%29._current-proxy-servers%29%29>
 
   and current-no-proxy-servers, which show they respect http_proxy, 
   https_proxy, and no_proxy.

There are also get-pure-port 
<https://docs.racket-lang.org/net/url.html?q=net%2Furl#%28def._%28%28lib._net%2Furl..rkt%29._get-pure-port%2Fheaders%29%29>
 
related functions that allow setting headers, which I think should let you 
set your cookies? For JSON, you can take look at the json 
<https://docs.racket-lang.org/json/index.html?q=json> docs if you're 
interested in converting the HTTP response bodies into a JSON expression. 
These expressions can then be treated like any other expression where you 
can map/filter/fold over lists and access map elements with hash table 
functions.

To find this stuff, I just searched for "http" and "json" using the ". . . 
search manuals . . ." box at the top right of the docs. The search looks 
through all of the Racket API as well as many user-contributed packages. It 
makes it very easy to find whatever you might be interested in.

Evan

On Saturday, May 16, 2020 at 7:45:08 AM UTC-10, fixpoint wrote:
>
> I'm on the search for a new programming language to learn, so I thought 
> I'd check out Racket, but I'm having a hard time trying to do a very common 
> task that would make Racket practical for my use at work:
>
>    - Make a series of HTTP requests to an API that returns JSON responses
>    - Reuse the HTTP connection to avoid creating new TCP connections for 
>    each request
>    - Honors the `http_proxy`, `https_proxy`, and `no_proxy` environment 
>    variables
>    - Maintains a "session" where cookies set by the server are sent back 
>    in subsequent requests
>
> My daily driver is Python, so I'm used to its `requests` library. Go and 
> Rust have similar libraries. While I don't mind piecing some of this 
> together, I'm struggling as a new user to figure out what libraries are 
> recommended and, more importantly, how to put them together to accomplish 
> the above points.
>
> Thank you.
>
> p.s. The Racket documentation is by far the best looking documentation 
> I've read in any language. It's quite amazing!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a5923caf-d735-4e3f-af5b-1fd7c81bc65b%40googlegroups.com.

Reply via email to