Adil Khashtamov

Hi. My name is Adil. I am passionate about building software. This blog is a notebook of my thoughts and ideas regarding software engineering and life around it. Currently I am interested in engineering of modern web apps, machine learning and data analysis.

Book on creating a Telegram bot

As you may know I have written two quite popular posts about creating a Telegram bot with Python and Django. People very often send me emails with questions related to Telegram, Chatbots and Python. Usually they finish my two part tutorial and have no idea how to move on in order to implement their specific idea. Answering those questions or even solving some particular problems takes time and energy.

That’s why I decided to release a book about creating a Telegram bot based on my experience. I have created two quite popular niche bots for Russian-speaking audience in my country — KitapBot and QinoBot. Besides those bots I also did some freelance job related to Telegram bots. All bots are written in Python and frameworks like Django, Bottle and Flask.

Having a good expertise in Python, Web and Telegram bots gives me an ability to share my knowledge with the rest of the world. Telegram is becoming very popular nowadays and it is time to learn it.

I just started writing my book, so I am eager to know if you have any ideas or topics which should be covered in the book. Please let me know in comments below or drop me a message on email.

If you want to be notified when the book is released and get a discount, please make a subscription below.

Approximate price for my ebook will be around $10-15, I think it is fair.

read more

Data analysis with Pandas

pandas probably is the most popular library for data analysis in Python programming language. This library is a high-level abstraction over low-level NumPy which is written in pure C. I use pandas on a daily basis and really enjoy it because of its eloquent syntax and rich functionality. Hope this note will help you dive into data analysis realm with Python and pandas.

DataFrame and Series

In order to master pandas you have to start from scratch with two main data structures: DataFrame and Series. If you don't understand them well you won't understand pandas.

Series

Series is an object which is similar to Python built-in list data structure but differs from it because it has associated label with each element or so-called index. This distinctive feature makes it look like associated array or dictionary (hashmap representation).

 

>>> import pandas as pd
>>> my_series = pd.Series([5, 6, 7, 8, 9, 10])
>>> my_series
0     5
1     6
2     7
3     8
4     9
5    10
dtype: int64
>>> 
read more

How To Deploy a Telegram Bot

Part 1 — How To Create a Telegram Bot Using Python 

This is the second part of my small tutorial about creating a Telegram bot using Python and Django. Today I am going to show you how to deploy our Django app on Digital Ocean VPS hosting, we are going to use Linux Ubuntu 14.04 LTS version.

What you are going to learn:

  • How to deploy a django app (or any WSGI app) on Digital Ocean using SSH access
  • How to work with gunicorn and nginx
  • How to control your processes using supervisord
  • Setting up virtualenv using pyenv
  • Adding our app to system autorestart (init.d)

Even despite we are going to work with Django app, this instruction will be applicable for any Python WSGI web application, so do not hesitate to use it with Pyramid, Flask, Bottle or any other popular web application framework in Python ecosystem. In this post I am going to use VPS (Virtual Private Server) on popular Digital Ocean hosting. By the way, if you sign up using my link, you will get $10 credit instantly on your account, money can be used to buy small servers and use them for your own purposes.

read more

How To Create a Telegram Bot Using Python

Telegram

For the past year, Telegram has introduced tons of new features including in-app games, bots, Telegraph and Instant Views, channels, groups and many more. What's going to be a next killer feature? Nobody knows. In this humble note I would like to show you how you can create a simple telegram bot using a popular programming language called Python.

Bots are great at many things, especially at automating borings tasks. It is up to your imagination what functions your future bot will have, but today we are going to create the one which will communicate with Planet Python, popular Python news aggregator. Bot will simply parse latest content and send it back to you via Telegram.

Our app will consist of django app and its source code is available on my github as planetpython_telegrambot repo. Feel free to fork and do whatever you want to do :)

read more

Celery Best Practices: practical approach

Celery logo

Celery is the most advanced task queue in the Python ecosystem and usually considered as a de facto when it comes to process tasks simultaneously in the background. The lastest version is 4.0.2, community around Celery is pretty big (which includes big corporations such as Mozilla, Instagram, Yandex and so on) and constantly evolves. Hence investing your time in this technology pays back.

This article is not about how to set up Celery, installation is pretty straightforward and instructions can be found on the official website. Instead, I would like to emphasize your attention on best practices while working with Celery.

Tips & Tricks with Celery

read more
  • 1