How to use the command peludna-prognoza (with examples)
This command allows users to fetch pollen measurement data for Croatian cities from their terminal using Pliva’s allergies data API. By providing a city name, users can obtain data on pollen measurements for that specific location.
Use case 1: Start an interactive search for a city and fetch data for it
Code:
peludna-prognoza
Motivation: This use case is useful when the user wants to explore the available cities for pollen measurement data and obtain data for a specific city of interest.
Explanation: By simply running the peludna-prognoza
command without any arguments, an interactive search prompt will appear in the terminal. The user can then enter the name of the desired city and press enter to fetch the pollen measurement data for that city.
Example output:
Please enter the name of the city: Zagreb
Fetching pollen measurement data for Zagreb...
Date: October 19, 2021
Tree pollen count: Moderate
Weed pollen count: Low
Grass pollen count: High
Use case 2: Fetch data for a city
Code:
peludna-prognoza "city"
Motivation: This use case is useful when the user already knows the name of the city they want to obtain pollen measurement data for and wants to fetch the data directly.
Explanation: By running the peludna-prognoza
command followed by the name of the city in quotes, the user can obtain the pollen measurement data for that specific city. Replace “city” with the name of the desired city.
Example output:
Fetching pollen measurement data for Zagreb...
Date: October 19, 2021
Tree pollen count: Moderate
Weed pollen count: Low
Grass pollen count: High
Use case 3: Display data in a machine-readable format
Code:
peludna-prognoza "city" --json|xml
Motivation: This use case is useful when the user wants to process the pollen measurement data programmatically or integrate it with other tools or systems that require machine-readable formats.
Explanation: By adding the --json
or --xml
flag after specifying the city name, the user can request the command to display the pollen measurement data in either JSON or XML format. Replace “city” with the name of the desired city.
Example output:
{
"date": "2021-10-19",
"tree_pollen_count": "Moderate",
"weed_pollen_count": "Low",
"grass_pollen_count": "High"
}
Use case 4: Display the pollen measurement page for a city in the default web browser
Code:
peludna-prognoza "city" --web
Motivation: This use case is useful when the user wants to quickly access the detailed pollen measurement page for a specific city in their default web browser.
Explanation: By adding the --web
flag after specifying the city name, the command will open the default web browser and navigate to the pollen measurement page for the selected city on the Pliva Health website. Replace “city” with the name of the desired city.
Example output: N/A (the browser will open with the relevant page displayed)
Conclusion
The peludna-prognoza
command provides a convenient way to fetch pollen measurement data for Croatian cities directly from the terminal. By using different combinations of arguments, users can obtain data for specific cities, display it in machine-readable formats, or open the pollen measurement page in their default web browser. This command is valuable for individuals who want to stay informed about pollen levels in different cities or utilize the data for research purposes.