[ninux-not-wireless] Scriptino Python per Twitter

LuX lux at autistici.org
Fri Apr 23 03:08:15 CEST 2010


@Hispanico:

lo scriptino di cui ti parlavo al FusoLAB era questo:

--TwitterStatusUpdate.py-------------------------------------------------------

from random import choice
from os import system

month = [ 6, 9 ]
strz = { 6: 'Giugno', 9: 'Settembre' }
dates = { 6 : ['17, 18, 19', '24,25,26'], 9: ['16,17,18','23,24,25'] }
SceltoACaso = choice( month )

Messaggio =  "WeekEnd scelto casualmente: %s [%s]" % \
     ( strz[SceltoACaso], choice( dates[SceltoACaso] ) )

user = 'NomeUtenteTwitter'
passwd = 'PasswordTwitter'

cmd = "curl -u %s:%s http://twitter.com/statuses/update.xml -d status='%s'" % \
             ( user, passwd, Messaggio )

system( cmd )
# print( cmd ) # only for debug purpose

-------------------------------------------------------------------------------

La parte interessante è il comando "cURL", 
(il resto serve solo a selezionare un WeekEnd casuale tra quelli indicati).

Non mi ricordo dove l'ho pescato.. (mi pare fosse passato in lista HM).

Comunque, qui:  http://j.mp/OaWV7  trovi more info. 

--
LuX

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Questa è un messaggio firmato elettronicamente
URL: <http://ml.ninux.org/pipermail/not-wireless/attachments/20100423/5c09d98a/attachment-0001.sig>


More information about the Not-wireless mailing list