[plt-scheme] use web service from scheme?

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Tue Jan 27 23:13:53 EST 2009

Andrew Reilly wrote:
> On Sun, Jan 25, 2009 at 03:52:56PM -0500, David Van Horn wrote:
>> Ask if you have more questions.
> 
> Thanks for the cool tutorial/examples.
> 
> I do have a question, though: why did you shell out to a
> separate curl process, rather than using get-pure-port from the
> net/url library?

There was an issue with using username:password in URLs, which has been 
resolved in SVN.  However, you would still have to instantiate the url 
unit for SSL connections (see the Scheme Cookbook [1] -- this really 
should be part of PLT).  Finally, even after doing all that, for some 
reason, I couldn't successfully fetch results from delicious.  So I just 
used curl.

Maybe some else has an idea why this doesn't work?

#lang scheme
(require net/ssl-url) ;; From cookbook.

(copy-port
  (ssl:get-pure-port
   (ssl:string->url
    "https://dvanhorn:[email protected]:443/v1/posts/recent"))
  (current-output-port))

Prints:

<?xml version="1.0" standalone="yes"?>
<result code="access denied" />
<!-- fe06.api.del.ac4.yahoo.net uncompressed Tue Jan 27 20:09:01 PST 
2009 -->

David

[1] http://schemecookbook.org/view/Cookbook/WebFetchingHttpsUrl



Posted on the users mailing list.