Hello @community, I am interested in gaining more insight into “High-level HTTP client library” project .
As per the project description, the goal is to implement a high-level library for HTTP requests, similar to the Python requests library. This library aims to facilitate standard HTTP request methods (GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, and PATCH) for Fortran programmers. So i think for this project we will create an fpm package, which will utilize fortran-curl, a set of Fortran bindings to libcurl, as a starting point. The package will include procedures for all standard HTTP request methods.
The intended outcome of this project is to enable easier consumption of HTTP web services from Fortran applications.
So end result will be something like this :
Let say in this project we have implemented a fortran package with name “http”.
In Code :
program http_demo
use http ! we implement this http module
implicit none
type(response) :: res
character(20) :: url="https://httpbin.org/get", method="get"
res = send_request(method,url, otherOptoins…..)
print *, res%content ! <html>….</html>
print *, res%status_code ! 200
print *, res%ok ! .true.
end program http_demo
so here in this code we have use http
module, create variable res which is instance of derived type response
(it’s defination will be implemented in the http
module itself), and call a procedure(or funciton) send_request
, which has taken url
and method
as argument (it can take many argument like method url
, params
, data
, headers
, files
, cookies
, timeout
and many more) and it will return a response
type datatype, using which we are printing the response content, response status, using the property res%content
, res%status_code
and res%ok
(it can have many property like content
, cookies
, headers
, status_code
, ok
, url
and many more).
So this is what I have understood about the project.
I would be grateful if you could provide me with further information, suggestions, and resources to better understand the project. Additionally, please let me know if I am going in the wrong direction with my understanding of the project.
Thank you for your time and consideration.
Sincerely,
Rajkumar
@interkosmos @milancurcic