Login to hotmail python 3.x

221 Views Asked by At

I'd like to login to hotmail.com and choose an email with a defined object, verify its content upon some parameters, and answer if the parameters correspond to the chosen ones. I tried the awangga library but it's not working with python 3.x. (even adding the originally missing parentheses required by the print() method in python3 ).

Any ideas?

Thanks in advance

this is the error I get when I use print(mail.unread())

mail.inbox() print(mail.unread()) logged in as [email protected] 
[b'LOGIN completed.'] Traceback (most recent call last): File 
"outlooklogin.py", line 7, in <module> print(mail.unread()) File 
"/Users/adm...........k.py", line 156, in unread list = s. 
self.unreadIds() File line 134, in unreadIds list = d[0].split(' ') 
 TypeError: a bytes-like object is required, not 'str' –
1

There are 1 best solutions below

1
On

Python 3 supports unicode strings (str) and byte strings (written b'my string'). To me it seems like d[0] is a byte string and ' ' will be a unicode string. Thus the call to d[0].split(' ') complains as you're splitting a byte string with a unicode string. This is probably because the awangga library was written for Python 2 (where there was only one string type). The repository issues confirm this is the case.

I see another user named wesinator has made a fork of the library with fixes for Python3. You can look through the changes here: https://github.com/awangga/outlook/compare/master...wesinator:master

If you're happy with the changes you could install the forked version by running pip install https://github.com/wesinator/outlook/archive/master.zip.