www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Handy API examples for HTTP requests

reply bearophile <bearophileHUGS lycos.com> writes:
I've seen this with some examples of handy API for HTTP requests, useful for
the Phobos devs that want to add a Phobos module to perform such things:

http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html
http://pypi.python.org/pypi/requests

Bye,
bearophile
May 27 2011
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
My D curl wrapper (hopefully soon to be obsolete by a std.curl thing)
does it this way:

string response = curl(url); // does a GET on the url

string response = curl(url, some_post_data); // does a POST

string response = curl(url, some_post_data, post_content_type); // POST with a
special content type

string response = curlAuth(url, null, username, password); // auth GET

 = curlAuth(url, some_post_data, username, password); // authed POST



That way, most common scenarios are handled by very simple calls.
May 27 2011
prev sibling parent jdrewsen <jdrewsen nospam.com> writes:
Den 28-05-2011 00:43, bearophile skrev:
 I've seen this with some examples of handy API for HTTP requests, useful for
the Phobos devs that want to add a Phobos module to perform such things:

 http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html
 http://pypi.python.org/pypi/requests

 Bye,
 bearophile
That API is not far from the one I'm working on for etc.curl. I'm currently implementing the suggestions from the last round of reviews and it will probably be ready for the official review queue after that. /Jonas
May 28 2011