D
D
DavidDavidrrrr2021-06-16 19:53:00
Python
DavidDavidrrrr, 2021-06-16 19:53:00

How to get temp_C?

Here is the code
import telebot,requests
import json
response = requests.get(" api.worldweatheronline.com/premium/v1/weather.ashx... ")
r = response.json()["data"]

#print(r)
f=(r['current_condition'])
c=(f['temp_C'])

bot = telebot.TeleBot('1883463577:AAFKIw7nBzKvQ_0N9iUaL5l92ehX5gZmH5E')
@bot.message_handler(commands=['pogoda'])
def start_command(message) :
print(f)
bot.send_message(message.chat.id,f)
bot.polling()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ramis, 2021-06-16
@ramzis

import requests
r = requests.get('http://api.worldweatheronline.com/premium\
                    /v1/weather.ashx?key=784a62fa7ebe4e4b89a65727211606&q=48.85,2.35&\
                    num_of_days=2&tp=3&format=json').json()
print(r['data']['current_condition'][0]['temp_C'])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question