Build Weather Checker CLI App - Python programming + OpenWeatherMap API

  Рет қаралды 4,147

Bek Brace

Bek Brace

Күн бұрын

Hey guys.
In this programming tutorial video, I'm going to demonstrate how to build a command-line interface (CLI) application to check the weather for a certain country/city using Python and the OpenWeatherMap API.
The video starts with importing necessary libraries such as requests, argparse, chalk, and pyfiglet.
I'll then walk you through the code step-by-step, showing how to parse command-line arguments and construct the API URL with query parameters. The API request is made using the requests library and the response status code is checked to ensure successful retrieval of weather information. The JSON response from the API is parsed and relevant weather information, such as temperature, feels like temperature, description, icon, city, and country, are extracted.
Finally, the output is constructed with a weather icon and printed using the chalk library. By the end of the video, viewers will have learned how to create a functional CLI weather checker using Python and the OpenWeatherMap API.
GitHub: github.com/Bek...
Connect with me on social media:
* Follow me on Twitter: / bekbrace
* Like my Facebook page: / bekbrace
* Follow me on Instagram: / bek_brace
Equipment used in this production:
1- Keyboard
Logitech POP Keys Mechanical Wireless Keyboard with Customizable Emoji Keys, Durable Compact Design, Bluetooth or USB Connectivity, Multi-Device, OS Compatible - Blast Yellow
Link: amzn.to/3Qk6Hvq
2- Microphone
Rode VideoMic Pro R Camera-Mount Shotgun Microphone
Link: amzn.to/3GmKSaf
Join this channel to get access to perks:
/ @bekbrace

Пікірлер: 40
@shivangsaxena8958
@shivangsaxena8958 Жыл бұрын
I really like your coding style its really amazing
@BekBrace
@BekBrace Жыл бұрын
Thank you so much :)
@cahwardev9804
@cahwardev9804 Жыл бұрын
very nice video, really! I like that you share good content with us :D
@BekBrace
@BekBrace Жыл бұрын
Thank you very much 🙏
@mrboxxxx
@mrboxxxx Жыл бұрын
COOL - Thank You everyone!
@andgat3512
@andgat3512 Жыл бұрын
Wonderful tutorial! Unfortunately, I didn't understand how to add a dictionary with icons in code. Can you be so kind to explain? Thanks a lot.
@BekBrace
@BekBrace Жыл бұрын
Thank you :) It's so simple, all the codes and icons are from the openweathermap API :)
@TherealkevinAR
@TherealkevinAR 10 ай бұрын
Same here, I checked the websites. I get how the url is built. But even on source code on GitHub, I don't understand how you add directly into your code the weather icons. Do you use an additional package? Or you just copy paste as a string the url given on openapiweather?
@BekBrace
@BekBrace 7 ай бұрын
Hey guys ! Yes, the weather condition codes like "01d", "02d", "01n", "02n", etc., do exist in the OpenWeatherMap API. These codes are part of the response returned by the API to represent different weather conditions. Here's what these codes typically represent: - **"01d", "02d", "03d", etc.**: These codes with a "d" suffix represent daytime weather conditions. For example, "01d" represents clear sky during the day, "02d" represents few clouds during the day, and so on. - **"01n", "02n", "03n", etc.**: These codes with an "n" suffix represent nighttime weather conditions. For example, "01n" represents clear sky during the night, "02n" represents few clouds during the night, and so on. These codes allow the API to provide specific information about the weather conditions for both daytime and nighttime, allowing applications like the one in the script to display appropriate weather icons based on the time of day. I apologize for not explicitly explaining this in the video, I thought it is self explanatory, my bad 😊
@NoorSiddique-b9x
@NoorSiddique-b9x 3 ай бұрын
is that sign up and getting api key free of cost? on open weather map api . or will we have to pay after using key
@BekBrace
@BekBrace 3 ай бұрын
Don't worry brother, no payment is necessary
@MPAXEL
@MPAXEL Жыл бұрын
soon starting ?
@BekBrace
@BekBrace Жыл бұрын
Finished already
@vanishreer1492
@vanishreer1492 10 ай бұрын
can you please explain how you switched to terminal?
@BekBrace
@BekBrace 10 ай бұрын
CTRL ~
@vanishreer1492
@vanishreer1492 10 ай бұрын
@@BekBrace Thank you so much. I have one more doubt, the output is chalk.red but I'm unable to print output to chalk.green. Can I get your help, please?
@BekBrace
@BekBrace 7 ай бұрын
​@@vanishreer1492 Really? Ok, copy in your reply your code that is not working, I'll take a look
@MihyaAwujaha
@MihyaAwujaha 7 ай бұрын
This is brew,pypi or npm?
@BekBrace
@BekBrace 7 ай бұрын
certainly not brew, this is Microsoft Windows, pypi is not a package manager, and npm is used for node. Python uses PIP, but as i'm using a virtual environment here I used PIPENV.
@inteliconn995
@inteliconn995 Жыл бұрын
Thanks!
@BekBrace
@BekBrace Жыл бұрын
You're welcome
@NoorSiddique-b9x
@NoorSiddique-b9x 3 ай бұрын
im making this for my college project so im signing up for api key kindly tell me will i have to pay or how long will this work
@BekBrace
@BekBrace 3 ай бұрын
No payment is required / just you have a limited amount of API calls, that's all
@NoorSiddique-b9x
@NoorSiddique-b9x 3 ай бұрын
@@BekBrace how many amount of api calls? because i have to present this project on Thursday will it work till then?
@BekBrace
@BekBrace 3 ай бұрын
Check out their website
@BekBrace
@BekBrace 3 ай бұрын
It will work, don't worry ☺️
@NoorSiddique-b9x
@NoorSiddique-b9x 3 ай бұрын
@@BekBrace thankyou so much 🙂🤍
@lng1801
@lng1801 11 ай бұрын
Can you please explain why we are using api 2.5 instead of 3.0 ? What are the differences?
@BekBrace
@BekBrace 11 ай бұрын
You can use API 3, it's probably my mistake that I've been using 2.5 for some of my projects, but 3 should be fine too 😊
@ahmedssss5
@ahmedssss5 Жыл бұрын
I put Like on Bek videos then i watch 😂
@BekBrace
@BekBrace Жыл бұрын
Appreciate it 🙂👍
@abhishekck6871
@abhishekck6871 8 ай бұрын
What to do if i have to auto-refresh after a specific time ?
@BekBrace
@BekBrace 8 ай бұрын
I don't know tbh
@rishimondal3010
@rishimondal3010 9 ай бұрын
Can make CLI app with can return a query from neo4j database
@BekBrace
@BekBrace 9 ай бұрын
Of course
@rishimondal3010
@rishimondal3010 9 ай бұрын
​@@BekBraceclick is better than agrpase ?
@hassn_2024
@hassn_2024 Жыл бұрын
give me the dic code plz
@BekBrace
@BekBrace Жыл бұрын
The code is in the description
@herryisnotcommie
@herryisnotcommie Жыл бұрын
plz code in Rust Version you must going crazy😊
@BekBrace
@BekBrace Жыл бұрын
Okay 👍🙂 i will do that for you
City Locator Application in Python - CLI App
20:13
Bek Brace
Рет қаралды 1,5 М.
Creating a simple CLI with Python Click
13:34
FancyGUI
Рет қаралды 22 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 67 МЛН
Build A React JS Weather App - OpenWeatherMap API - Tutorial
36:52
Code Commerce
Рет қаралды 158 М.
Dioxus vs Leptos  | Rust GUI Wars #2
21:18
Creative Coders
Рет қаралды 2,5 М.
ChatGPT API in Python
35:18
sentdex
Рет қаралды 180 М.
Convert GUI App to Real Program -  Python to exe to setup wizard
23:27
Python Simplified
Рет қаралды 523 М.
How to use a Public API | Using a Public API with Python
14:01
Alex The Analyst
Рет қаралды 45 М.
How To Build A Trading Bot In Python
18:46
CodeTrading
Рет қаралды 770 М.
Argparse Tutorial - Python  2023 (Creating Your First CLI)
18:59
ASMR Programming - Weather App With Javascript - No Talking
20:30
AsmrProg
Рет қаралды 2,7 МЛН
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН