Skip to content

Commit 2bc5cc4

Browse files
author
Toben Archer
committed
Fixed issue googleapis#41.
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.
1 parent 3b4dd7d commit 2bc5cc4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

O365/attachment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ def setByteString(self,val):
141141
'''Sets the file for this attachment from a byte string.'''
142142
try:
143143
if sys.version_info[0] == 2:
144-
self.json['ContentBytes'] = base64.encodebytes(val)
144+
self.json['ContentBytes'] = base64.b64encode(val)
145145
else:
146146
self.json['ContentBytes'] = str(base64.encodebytes(val),'utf-8')
147-
except:
148-
log.debug('error encoding attachment.')
147+
except Exception as e:
148+
log.debug('error encoding attachment: {0}'.format(e))
149149
return False
150150
return True
151151

O365/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def sendMessage(self):
100100
data = json.dumps(data)
101101
log.debug(str(data))
102102
except Exception as e:
103-
log.error(str(e))
103+
log.error('Error while trying to compile the json string to send: {0}'.format(str(e)))
104104
return False
105105

106106
response = requests.post(self.send_url,data,headers=headers,auth=self.auth)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
https://github.com/Narcolapser/python-o365'''
3434

3535
setup(name='O365',
36-
version='0.9.4',
36+
version='0.9.5',
3737
description='Python library for working with Microsoft Office 365',
3838
long_description=long_desc,
3939
author='Toben Archer',
@@ -42,7 +42,7 @@
4242
maintainer_email='sandslash+O365@gmail.com',
4343
url='https://github.com/Narcolapser/python-o365',
4444
packages=['O365'],
45-
# install_requires=['requests'],
45+
install_requires=['requests'],
4646
license='Apache 2.0',
4747
classifiers=CLASSIFIERS
4848
)

0 commit comments

Comments
 (0)