Writing a Telegram.org bot in Python

Hi, Telegram.org recently announced the support for writing bots for their platform, by providing details at https://core.telegram.org/bots. I was missing for a long time the ability to get a count on karma like we’ve on IRC servers, so I started with it. My first try is published at github repo in https://github.com/iranzo/stampython. At the moment it just uses the polling interface to check the new messages received on the channels the bot is in, and later processes them and send the relevant replies via messages. ...

June 26, 2015 · 1 min · Pablo Iranzo Gómez

Migrate SPIP-RSS post feed to HTML

I had my old blog based on SPIP, and I wanted to keep all the posts together, to make it easier to migrate in the future. Initially, I migrated my posts from blogger, where there’s an option to export the contents and some plugins to allow easier importing to markdown files (to be used by OctoPress), those were the recent posts, so part of the job was already done there. Next step, was to migrate old posts on my SPIP site. ...

April 1, 2015 · 2 min · Pablo Iranzo Gómez

RHEV/oVirt API with Python

RHEV/oVirt API allows faster and simple development of scripts and utilities ranging from gathering of information to VM/host, etc manipulation. For example, a simple script for connecting to API and list VM’s could be: import sys import getopt import optparse import os import time from ovirtsdk.api import API from ovirtsdk.xml import params from random import choice baseurl = "https://localhost:8443" api = API(url=baseurl, username="admin@internal", password="redhat", insecure=True) for vm in api.vms.list(): print(vm.name) The .list() method works pretty well, but beware, it limits collections to 100 elements for performance reasons, so in those cases, we’ll need to check how many results do we have, and paginate by passing an extra argument to our “.list()” invocation, for example: ...

October 24, 2012 · 2 min · Pablo Iranzo Gómez
This blog is a participant in the Amazon Associate Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.