Articles Tagged api

OAuth and django rest framework

OAuth and django rest framework

This is a well known topic, but i can't find the existing solution that will fully satisfy me. So i write it by myself :).

Assume we have a "single page" web site, that is talking with backend via REST API. Client side can be written with ember, angularjs or some like this. Backend - django rest framework (DRF). We've got a task - add social login (OAuth protocol).

How it will look like in case ...

Posted on 2015-07-18

OAuth step by step

OAuth step by step

OAuth protocol has two versions: 1.0 and 2.0.

Most of services today use version 2.0, i suppose because it is easier to implement. Also, 2.0 can be realized in standalone applications (those, that don't have a server).

To understand the protocols very useful to have a look at their realisation. Here i'll show several scripts that talk to OAuth providers of different versions. Scripts will implement client application ...

Posted on 2015-05-16

Send email in django project with mandrill service

Send email in django project with mandrill service

To send email messages from server we can just use SMTP protocol. But there is another way - special email services. I'll describe one of them here,


  • Detailed statistic of sent emails. How many were sent, to whom, when. How many were opened, what links were clicked.
  • Message templates. They can be modified through mandrill service, no need to create anything in django admin. It is possible to use variables in ...

Posted on 2014-03-18

Async Bitcoin RPC client

To work with Bitcoin RPC from python there is a library Python-BitcoinRPC.

But recently i need to call API from tornado application. Mentioned lib works in synchronous, i.e. blocking mode. For tornado it will be much better to use asynchronous version. Tried to search for existing solution, but can't find it. So i create my async fork, that use tornado's AsyncHTTPClient:

Example (print current number of blocks ...

Posted on 2014-01-30

Script for downloading music from vkontakte

Vkontakte audio download

A quick search of corresponding python script doesn't give results. In post on habra link is broken. So i decided to write my own bicycle, it is avaliable here.

Launch (needs installed python interpreter):


Tested on python 2.6 and 2.7. No external libraries required.


Script checks saved access_token. If it doesn't exists or expired, then page with authorisation is opened in browser. After confirmation you will ...

Posted on 2013-02-04

Aphorism messenger

Aphorism messenger

I have an interesting project i want to tell you about. The idea to create it was born when i was learning Java. I have read couple of books, made some small task programs but i would like to create something bigger.

Project summary:

Desktop program (client), that lives in a tray and periodically shows aphorisms. It takes aphorisms from web-service (server), so data base with aphorisms lives in one place and it doesn't ...

Posted on 2012-08-31