I'm a beginner to AWS and AZure. I'm doing a lex bot which will do a appointment based on the agent's outlook calendar.I head to fetch outlook calendar details (available time for appointment) and make an appointment on outlook calendar using python library O365. I'm having the client ID and secret key and an api to fetch the O365 calendar(Got it from the admin). I don't have a proper documentation about this O365 functionalities or methods.
from O365 import Account
credentials = ('my_client_id', 'my_client_secret')
account = Account(credentials)
if account.authenticate(scopes=['basic', 'message_all']):
print('Authenticated!')
When i ran this code, says me something like visit some URL and paste the API endpoint.
Questions: 1)I need to know the request type and format to call this api and calendar related functions in the O365(or a proper documentation to use this O365) 2)Will this O365 library can be imported inside the aws Lambda ? will it be pre-installed?
UPDATE: I got tenant id and after using the own user identification method, now I'm able to authenticate. But After that when I'm doing this
from O365 import Account
import datetime as dt
credentials = ('xxxxx-0d57-49e5-xxxx-xxxxxxxx', 'xxxxx^[xxxxxxx[%')
account = Account(credentials, auth_flow_type='credentials', tenant_id='xxxxxx-e1ec-xxxxxxx-b1d9-xxxxxxxxx')
if account.authenticate():
print('Authenticated!')
schedule = account.schedule()
schedule.get_availability(['test@angkorwat.onmicrosoft.com'],dt.datetime(2019, 9, 5, 19, 45),dt.datetime(2019, 9, 10))
I'm getting the following error Resource not found for the segment 'calendar',
> C:\Users\MyPc\Desktop>python user_himself.py
> Authenticated! Client
> Error: 400 Client Error: Bad Request for url:
> https://graph.microsoft.com /v1.0/calendar/getSchedule | Error
> Message: Resource not found for the segment ' calendar'. Traceback
> (most recent call last): File "user_himself.py", line 13, in
> <module>
> schedule.get_availability(['test@angkorwat.onmicrosoft.com'],dt.datetime(
> 2019, 9, 5, 19, 45),dt.datetime(2019, 9, 10)) File
> "C:\Users\MyPc\AppData\Local\Programs\Python\Python37\lib\site-packages
> \O365\calendar.py", line 1931, in get_availability
> response = self.con.post(url, data=data) File "C:\Users\MyPc\AppData\Local\Programs\Python\Python37\lib\site-packages
> \O365\connection.py", line 725, in post
> return self.oauth_request(url, 'post', data=data, **kwargs) File "C:\Users\MyPc\AppData\Local\Programs\Python\Python37\lib\site-packages
> \O365\connection.py", line 703, in oauth_request
> return self._internal_request(self.session, url, method, **kwargs) File
> "C:\Users\Mypc\AppData\Local\Programs\Python\Python37\lib\site-packages
> \O365\connection.py", line 665, in _internal_request
> raise HTTPError('{} | Error Message: {}'.format(e.args[0], error_message), r esponse=response) from None
> requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
> https://graph.microsoft.com/v1.0/calendar/getSchedule | Error
> Message: Resource not found for the segment 'calendar'.