понеділок, 22 грудня 2014 р.

Graph statistic with Pygal

In this lesson I will show you how to use Pygal python library. This library can be used for demonstrating of any statistics and so on. Installation is easy as usual:

# pip install pygal

For correct work and importing svg to png you need to install such libs too:

# pip install -U lxml cairosvg tinycss cssselect

Lets go! This is first trivial example:


субота, 20 грудня 2014 р.

How to use Python Digital Ocean API

I am using Digital Ocean and can advice them as good hosting provider. But DO also have unpleasant feature - you cant turn on autobackup if you did not choose it before creating VM. Fortunately Digital Ocean admin panel have ability to snapshot VM (but with reboot :() and I will show you how to backup VM at once with DO API.
So at first, as usual, you need to setup python library:

pip install -U python-digitalocean

We will use python wrapper for DO API. It is easier than use REST API. So let me show you some trivial examples:


Output:

gray.my.com
blabla.my.net
nagios.my.com
test.my.com

вівторок, 9 грудня 2014 р.

Working with Redmine with python-redmine


I think many of you know what is Redmine. Target of this article is to show how to use python-redmine library for managing Redmine web instance via REST api. Sure you can use parsing with BeautifulSoup or like that but better to use official methods. Also you can use other alternative pyredminews etc.

So as usual first of all you need to install library:

# pip install python-redmine

Using of this library is pretty easy:


requests={'verify': False}
is for bad ssl certificate installed on https://redmine.example.com

четвер, 30 жовтня 2014 р.

How to use BeautifulSoup library (websites parser)

BeautifulSoup is python library for parsing Web-sites. It is pretty easy to use it. First of all you need to install library using PIP or easy_install and import it.

# pip install beautifulsoup4
# easy_install beautifulsoup4

And this is good example from Youtube chanell of CodingEntrepreneurs user: