Skip to content

Commit b0d7729

Browse files
committed
Add support for filter by due datetime in Tasks
Also added extra detail to connection error reporting. In support of - RogerSelwyn/O365-HomeAssistant#130
1 parent c15e252 commit b0d7729

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

O365/connection.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,22 @@ def _internal_request(self, request_obj, url, method, **kwargs):
792792
try:
793793
error = response.json()
794794
error_message = error.get('error', {}).get('message', '')
795+
error_code = (
796+
error.get("error", {}).get("innerError", "").get("code", "")
797+
)
795798
except ValueError:
796799
error_message = ''
800+
error_code = ''
797801

798802
status_code = int(e.response.status_code / 100)
799803
if status_code == 4:
800804
# Client Error
801805
# Logged as error. Could be a library error or Api changes
802-
log.error('Client Error: {} | Error Message: {}'.format(str(e), error_message))
806+
log.error(
807+
"Client Error: {} | Error Message: {} | Error Code: {}".format(
808+
str(e), error_message, error_code
809+
)
810+
)
803811
else:
804812
# Server Error
805813
log.debug('Server Error: {}'.format(str(e)))

O365/utils/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ class Query:
599599
'to': 'toRecipients/emailAddress/address',
600600
'start': 'start/DateTime',
601601
'end': 'end/DateTime',
602+
'due': 'duedatetime/DateTime',
602603
'flag': 'flag/flagStatus',
603604
'body': 'body/content'
604605
}

0 commit comments

Comments
 (0)