ich versuche mir einen kleinen MSN Messenger zu basteln. Da ich mich mit dem Modul msnlib nicht auskenne habe ich mir zunächst ein Script gesucht, das den Umgang mit diesem Modul zeigt.
Ich bekomme wärend der Login-Phase immer folgenden Error:
Traceback (most recent call last):
File "<string>", line 1, in ?
File "C:\Dokumente und Einstellungen\Besitzer\Desktop\msn.py", line 24, in ?
m.login()
File "C:\Programme\Python\lib\msnlib.py", line 506, in login
passportid = self.passport_auth(hash)
File "C:\Programme\Python\lib\msnlib.py", line 526, in passport_auth
nexus = urllib.urlopen('https://nexus.passport.com/rdr/pprdr.asp')
File "C:\PROGRA~1\Python\lib\urllib.py", line 73, in urlopen
return _urlopener.open(url)
File "C:\PROGRA~1\Python\lib\urllib.py", line 175, in open
return self.open_unknown(fullurl, data)
File "C:\PROGRA~1\Python\lib\urllib.py", line 187, in open_unknown
raise IOError, ('url error', 'unknown url type', type)
IOError: [Errno url error] unknown url type: 'https'
Kann mir jemand sagen, woran das liegt?
Hier ist der code:
Code: Alles auswählen
#!/usr/bin/env python
# time, for sleeping (see last line)
import time
# select to wait for events
import select
# socket, to catch errors
import socket
import msnlib
import msncb
m = msnlib.msnd()
m.cb = msncb.cb()
m.email = "test5@hotmail.com"
m.pwd = "123456"
print "Logging In"
m.login()
print "Sync"
# this makes the server send you the contact list, and it's recommended that
# you do it because you can get in trouble when getting certain events from
# people that are not on your list; and it's not that expensive anyway
m.sync()
print "Changing Status to online"
# any non-offline status will do, otherwise we'll get an error from msn when
# sending a message
m.change_status("away")
print "Sending:",
# send a message
print m.sendmsg("lordmyder5@hotmail.com", "Hello World - take two")
# we loop over the network socket to get events
print "Loop"
while 1:
# we get pollable fds
t = m.pollable()
infd = t[0]
outfd = t[1]
# we select, waiting for events
fds = select.select(infd, outfd, [], 0)
for i in fds[0] + fds[1]: # see msnlib.msnd.pollable.__doc__
try:
m.read(i)
except ('SocketError', socket.error), err:
if i != m:
# user closed a connection
# note that messages can be lost here
m.close(i)
else:
# main socket closed
quit(1)
# sleep a bit so we don't take over the cpu
time.sleep(0.01)
LordMyder