Skip to content

Commit

Permalink
Fixed issue googleapis#41.
Browse files Browse the repository at this point in the history
I had accidentally used the python 3 method for encoding bytes in the
attachment class. Fixed that, attachments should work now. I appearently
just never actually touched that.
  • Loading branch information
Toben Archer committed Nov 10, 2016
1 parent 3b4dd7d commit 2bc5cc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions O365/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def setByteString(self,val):
'''Sets the file for this attachment from a byte string.'''
try:
if sys.version_info[0] == 2:
self.json['ContentBytes'] = base64.encodebytes(val)
self.json['ContentBytes'] = base64.b64encode(val)
else:
self.json['ContentBytes'] = str(base64.encodebytes(val),'utf-8')
except:
log.debug('error encoding attachment.')
except Exception as e:
log.debug('error encoding attachment: {0}'.format(e))
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion O365/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def sendMessage(self):
data = json.dumps(data)
log.debug(str(data))
except Exception as e:
log.error(str(e))
log.error('Error while trying to compile the json string to send: {0}'.format(str(e)))
return False

response = requests.post(self.send_url,data,headers=headers,auth=self.auth)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
https://github.com/Narcolapser/python-o365'''

setup(name='O365',
version='0.9.4',
version='0.9.5',
description='Python library for working with Microsoft Office 365',
long_description=long_desc,
author='Toben Archer',
Expand All @@ -42,7 +42,7 @@
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
)
Expand Down

0 comments on commit 2bc5cc4

Please sign in to comment.