Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ridiculously over due. But I wasn't able to fix it until recently. I added
a python version check to point the user to the correct form of dealing
with 64base encoding and unicode. So now it shouldn't have any further
issues.
  • Loading branch information
Toben Archer committed Nov 7, 2016
1 parent 8bec2a5 commit c4021b0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion O365/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import json
import requests
import sys

#from O365 import Message

Expand Down Expand Up @@ -145,7 +146,10 @@ def setName(self,val):
def setByteString(self,val):
'''Sets the file for this attachment from a byte string.'''
try:
self.json['ContentBytes'] = base64.encodebytes(val)
if sys.version_info[0] == 2:
self.json['ContentBytes'] = base64.encodebytes(val)
else:
self.json['ContentBytes'] = str(base64.encodebytes(val),'utf-8')
except:
log.debug('error encoding attachment.')
return False
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,8 @@ m.sendMessage()
## Looking for new maintainer
I no longer, as of October 2015, have an office365 account and so I'm looking for someone to take over this project. Please fork and carry on.

#Maybe not as much now.
New company I work for has given me a testing account for O365. So I can actually do some work again.


#### Soli Deo Gloria
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
maintainer_email='sandslash+O365@gmail.com',
url='https://github.com/Narcolapser/python-o365',
packages=['O365'],
install_requires=['requests'],
# install_requires=['requests'],
license='Apache 2.0',
classifiers=CLASSIFIERS
)


#so I don't have to keep looking it up: python setup.py sdist upload -r pypi
2 changes: 1 addition & 1 deletion tests/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def json(self):


def get(url,**params):
if url != 'https://outlook.office365.com/EWS/OData/Me/Calendars':
if url != 'https://outlook.office365.com/api/v1.0/me/calendars':
raise
if params['auth'][0] != 'test@unit.com':
raise
Expand Down

0 comments on commit c4021b0

Please sign in to comment.