Вот код:
import Image, ImageTk, Tkinter
import urllib, urllib2, cookielib
# -*- coding: utf-8 -*-
urllib.urlretrieve('http://www.sms.tele2.ru/get_rni.php?public_key=b0e6afa4f84eae7757d0f569c00b3f75', 'code.png')
FILENAME = 'code.png'
tk = Tkinter.Tk()
c = Tkinter.Canvas(tk, width=128, height=128)
src_img = Image.open(FILENAME)
img = ImageTk.PhotoImage(src_img)
c.create_image(0, 0, image=img, anchor="nw")
c.pack()
phonecod = "XXX"
number = 'XXXXXXXX'
textsms = 'Privet'
captcha = raw_input('code:')
cookieJar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar))
req = urllib2.Request('http://www.sms.tele2.ru/')
params = urllib.urlencode({'phone_code':phonecod,'number':number,'smstext':textsms,'sms_text':textsms,'private_key':captcha,'do':'send'})
g = opener.open(req,params)
ga = g.read()
print ga
tk.mainloop()