Skip to content

Added Tutorial for beginner(phase 1, only get request demonstration) #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

rajkumardongre
Copy link
Contributor

No description provided.

@rajkumardongre
Copy link
Contributor Author

Test URL(https://www.w3schools.com/python/demopage.php) which we have used for the head request was not working properly, so I have change it to https://postman-echo.com/head

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! The tutorial LGTM. I used it as an example for one of my cases (that requires to provide some data).

module utils
implicit none

! Declare the function as public to make it accessible to other modules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
! Declare the function as public to make it accessible to other modules
private
! Declare the function as public to make it accessible to other modules


### Step 4: Create `utils.f90`

In order to encapsulate helper functions for the program, we'll create a new file named `utils.f90` in the `src` folder. This module will contain the `int_to_str` function, which takes an integer as input and returns a string equivalent of that integer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of distracting the reader (at least me, who tries to follow this tutorial to apply it on one of my cases). Why did you choose to implement your own function, instead of using to_string() provided by stdlib?

!! flag for weather the current repo found or not

! Initialize the `api_url` variable with the GitHub API URL for fetching repositories
api_url = 'https://github.com/api/orgs/fortran-lang/repos'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be define as a parameter

api_url = 'https://github.com/api/orgs/fortran-lang/repos'

! Make an HTTP GET request to the API URL and store the response in the `response` variable
response = request(url=api_url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the tutorial, it might be good to show how to check that the response was ok.

```toml
[dependencies]
http.git = "https://github.com/fortran-lang/http-client.git"
stdlib = "*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires at least fpm v0.9.0. It might be good to mention it earlier.

@rajkumardongre
Copy link
Contributor Author

Thanks @jvdp1 for the suggestions, I will add them

@rajkumardongre
Copy link
Contributor Author

Hello @jvdp1, I've included a comprehensive tutorial on the http package and incorporated the tutorial "Building a GitHub Organization Analyzer in Fortran, using http-client" with the necessary modifications as mention by you. Consequently, I'm closing this, since all the content is now in issue #53. Please take a look and review it.

@rajkumardongre rajkumardongre deleted the tutorial branch September 14, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants