Skip to content

Instantly share code, notes, and snippets.

@guerrerocarlos
Last active December 18, 2015 21:29
Show Gist options
  • Save guerrerocarlos/5847616 to your computer and use it in GitHub Desktop.
Save guerrerocarlos/5847616 to your computer and use it in GitHub Desktop.
Ejemplo sencillo de envío de un mensaje utilizando Libturpial. Incluye registro de la cuenta
# -*- coding=utf-8 -*-
from libturpial.api.models.account import Account
from libturpial.api.core import Core
c = Core()
cuenta = "guerrerocarlos-twitter"
mensaje = "Probando desde libturpial"
cuentas_registradas = c.list_accounts()
print "Cuentas registradas: ",cuentas_registradas,"\n"
if cuenta in cuentas_registradas:
print "Cargando cuenta",cuenta,"\n"
print c.update_status("guerrerocarlos-twitter","Probando desde libturpial")
else:
a = Account.new('twitter')
url = a.request_oauth_access()
print "Por favor Acceda a la URL, inicie sesión y escriba a continuación el PIN:"
print url
cod = raw_input("PIN:")
a.authorize_oauth_access(cod)
c.register_account(a)
@satanas
Copy link

satanas commented Jun 24, 2013

@guerrerocarlos De nada mi pana. La línea 14 podría quedar incluso así:

print c.update_status(cuenta, "Probando desde libturpial")

Saludos ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment