I, Python and from the work groan

 
3r3-31. This article will not be helpful to experienced Python developers. Here I describe how I started writing in this beautiful language, as well as this is my first article on Habré. Please do not throw too much tomatoes 3r3122.  
library. pyTelegramBotAPI 3r376.  
3r375. You can start with a simple program (TELEGRAM_KEY - the key that you get in step 1) 3r376.  
3r3122.  
import telebot
TELEGRAM_KEY = 3r3133.
bot = telebot.TeleBot (TELEGRAM_KEY)
@ bot.message_handler (commands =['start'])
def command_handler (request_message):
user = request_message.from_user
user_name = user.first_name
command_name = telebot.util.extract_command (request_message.text)
# common commands
if command_name == 'start':
bot.send_message (request_message.chat.id, 'Bot is running')
@ bot.message_handler (content_types =['text'])
def message_handler (request_message):
bot.send_message (request_message.chat.id, 'Your message: {0}'. format (request_message.text))
print ('Bot is running')
bot.polling ()
3r3108. 3r3122.  
Next, it was necessary to understand what this bot should do. And since I am fond of the history of cosmonautics and in general this whole topic with space, the study of galaxies, etc. I'm interested, then I decided to look for something related to NASA and their API. 3r3122.  
3r3122.  
3r3115. 3r3122.  
3r3122.  
Here is what I managed to find:
The official website 3r3121. NASA which describes primitive API services and mechanisms for working with them. So I started developing my first Telegram bot. 3r3122.  
PS: If the article goes, then I will write the specifics of the project.
3r3128. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () ();
+ 0 -

Add comment