diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 01:31:46 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 01:31:46 +0000 |
commit | ed469ed3c0e85d3a81a3b304f5f2f94a8b5540bc (patch) | |
tree | 809a9f3d051f1dedc64ec153cd4019553e715a37 | |
parent | 0468960e18a92dcad62d5f60608657a87d5802e6 (diff) |
automatic import of python-microsoftgraph-python
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-microsoftgraph-python.spec | 1198 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 1200 insertions, 0 deletions
@@ -0,0 +1 @@ +/microsoftgraph_python-1.1.6.tar.gz diff --git a/python-microsoftgraph-python.spec b/python-microsoftgraph-python.spec new file mode 100644 index 0000000..76e4d96 --- /dev/null +++ b/python-microsoftgraph-python.spec @@ -0,0 +1,1198 @@ +%global _empty_manifest_terminate_build 0 +Name: python-microsoftgraph-python +Version: 1.1.6 +Release: 1 +Summary: API wrapper for Microsoft Graph written in Python +License: MIT +URL: https://pypi.org/project/microsoftgraph-python/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/37/69/6ed91cdf7f69b130fb410b95abf8248fd33090c33ade6a1e9a952708cdc3/microsoftgraph_python-1.1.6.tar.gz +BuildArch: noarch + +Requires: python3-requests + +%description +# microsoftgraph-python +Microsoft graph API wrapper for Microsoft Graph written in Python. + +## Before start +To use Microsoft Graph to read and write resources on behalf of a user, your app must get an access token from +the Microsoft identity platform and attach the token to requests that it sends to Microsoft Graph. The exact +authentication flow that you will use to get access tokens will depend on the kind of app you are developing and +whether you want to use OpenID Connect to sign the user in to your app. One common flow used by native and mobile +apps and also by some Web apps is the OAuth 2.0 authorization code grant flow. + +See [Get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth-v2-user) + +## Breaking changes if you're upgrading prior 1.0.0 +- Added structure to library to match API documentation for e.g. `client.get_me()` => `client.users.get_me()`. +- Renamed several methods to match API documentation for e.g. `client.get_me_events()` => `client.calendar.list_events()`. +- Result from calling a method is not longer a dictionary but a Response object. To access the dict response as before then call `.data` attribute for e.g `r = client.users.get_me()` then `r.data`. +- Previous API calls made through beta endpoints are now pointing to v1.0 by default. This can be changed to beta if needed with the parameter `api_version` in the client instantiation. +- Removed Office 365 endpoints as they were merged with the Microsoft Graph API. See [Office 365 APIs](https://docs.microsoft.com/en-us/previous-versions/office/office-365-api/). +## New in 1.0.0 +- You can access to [Requests library's Response Object](https://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects) for e.g. `r = client.users.get_me()` then `r.original` or the response handled by the library `r.data`. +- New Response properties `r.status_code` and `r.throttling`. +- You can pass [Requests library's Event Hooks](https://docs.python-requests.org/en/latest/user/advanced/#event-hooks) with the parameter `requests_hooks` in the client instantiation. If you are using Django and want to log in database every request made through this library, see [django-requests-logger](https://github.com/GearPlug/django-requests-logger). +- Library can auto paginate responses. Set `paginate` parameter in client initialization. Defaults to `True`. +- Better method docstrings and type hinting. +- Better library structure. +## Installing +``` +pip install microsoftgraph-python +``` +## Usage +### Client instantiation +``` +from microsoftgraph.client import Client +client = Client('CLIENT_ID', 'CLIENT_SECRET', account_type='common') # by default common, thus account_type is optional parameter. +``` + +### OAuth 2.0 +#### Get authorization url +``` +url = client.authorization_url(redirect_uri, scope, state=None) +``` + +#### Exchange the code for an access token +``` +response = client.exchange_code(redirect_uri, code) +``` + +#### Refresh token +``` +response = client.refresh_token(redirect_uri, refresh_token) +``` + +#### Set token +``` +client.set_token(token) +``` + +### Users +#### Get me +``` +response = client.users.get_me() +``` + +### Mail + +#### List messages +``` +response = client.mail.list_messages() +``` +#### Get message +``` +response = client.mail.get_message(message_id) +``` + +#### Send mail +``` +data = { + subject="Meet for lunch?", + content="The new cafeteria is open.", + content_type="text", + to_recipients=["fannyd@contoso.onmicrosoft.com"], + cc_recipients=None, + save_to_sent_items=True, +} +response = client.mail.send_mail(**data) +``` + +#### List mail folders +``` +response = client.mail.list_mail_folders() +``` + +#### Create mail folder +``` +response = client.mail.create_mail_folder(display_name) +``` + +### Notes +#### List notebooks +``` +response = client.notes.list_notebooks() +``` + +#### Get notebook +``` +response = client.notes.get_notebook(notebook_id) +``` + +#### Get notebook sections +``` +response = client.notes.list_sections(notebook_id) +``` + +#### List pages +``` +response = client.notes.list_pages() +``` + +#### Create page +``` +response = client.notes.create_page(section_id, files) +``` + +### Calendar +#### Get events +``` +response = client.calendar.list_events(calendar_id) +``` + +#### Get event +``` +response = client.calendar.get_event(event_id) +``` + +#### Create calendar event +``` +from datetime import datetime, timedelta + +start_datetime = datetime.now() + timedelta(days=1) # tomorrow +end_datetime = datetime.now() + timedelta(days=1, hours=1) # tomorrow + one hour +timezone = "America/Bogota" + +data = { + "calendar_id": "CALENDAR_ID", + "subject": "Let's go for lunch", + "content": "Does noon work for you?", + "content_type": "text", + "start_datetime": start_datetime, + "start_timezone": timezone, + "end_datetime": end_datetime, + "end_timezone": timezone, + "location": "Harry's Bar", +} +response = client.calendar.create_event(**data) +``` + +#### Get calendars +``` +response = client.calendar.list_calendars() +``` + +#### Create calendar +``` +response = client.calendar.create_calendar(name) +``` + +### Contacts +#### Get a contact +``` +response = client.contacts.get_contact(contact_id) +``` + +#### Get contacts +``` +response = client.contacts.list_contacts() +``` + +#### Create contact +``` +data = { + "given_name": "Pavel", + "surname": "Bansky", + "email_addresses": [ + { + "address": "pavelb@fabrikam.onmicrosoft.com", + "name": "Pavel Bansky" + } + ], + "business_phones": [ + "+1 732 555 0102" + ], + "folder_id": None, +} +response = client.contacts.create_contact(**data) +``` + +#### Get contact folders +``` +response = client.contacts.list_contact_folders() +``` + +#### Create contact folders +``` +response = client.contacts.create_contact_folder() +``` + +### Files +#### Get root items +``` +response = client.files.drive_root_items() +``` + +#### Get root children items +``` +response = client.files.drive_root_children_items() +``` + +#### Get specific folder items +``` +response = client.files.drive_specific_folder(folder_id) +``` + +#### Get item +``` +response = client.files.drive_get_item(item_id) +``` + +#### Download the contents of a specific item +``` +response = client.files.drive_download_contents(item_id) +``` + +#### Upload new file +``` +# This example uploads the image in path to a file in the signed-in user's drive under Pictures named upload.jpg. +response = client.files.drive_upload_new_file("/Pictures/upload.jpg", "/mnt/c/Users/i/Downloads/image1.jpg") +``` + +#### Update existing file +``` +# This example uploads the image in path to update an existing item id. +response = client.files.drive_update_existing_file(item_id, "/mnt/c/Users/i/Downloads/image2.jpg") +``` + +#### Search for files +``` +query = ".xlsx, .xlsm" +response = client.files.search_items(query) +``` + +### Workbooks +#### Create session for specific item +``` +response = client.workbooks.create_session(workbook_id) +``` + +#### Refresh session for specific item +``` +response = client.workbooks.refresh_session(workbook_id) +``` + +#### Close session for specific item +``` +response = client.workbooks.close_session(workbook_id) +``` + +#### Get worksheets +``` +response = client.workbooks.list_worksheets(workbook_id) +``` + +#### Get specific worksheet +``` +response = client.workbooks.get_worksheet(workbook_id, worksheet_id) +``` + +#### Add worksheets +``` +response = client.workbooks.add_worksheet(workbook_id) +``` + +#### Update worksheet +``` +response = client.workbooks.update_worksheet(workbook_id, worksheet_id) +``` + +#### Get charts +``` +response = client.workbooks.list_charts(workbook_id, worksheet_id) +``` + +#### Add chart +``` +response = client.workbooks.add_chart(workbook_id, worksheet_id) +``` + +#### Get tables +``` +response = client.workbooks.list_tables(workbook_id) +``` + +#### Add table +``` +response = client.workbooks.add_table(workbook_id) +``` + +#### Add column to table +``` +response = client.workbooks.create_table_column(workbook_id, worksheet_id, table_id) +``` + +#### Add row to table +``` +response = client.workbooks.create_table_row(workbook_id, worksheet_id, table_id) +``` + +#### Get table rows +``` +response = client.workbooks.list_table_rows(workbook_id, table_id) +``` + +#### Get range +``` +response = client.workbooks.get_range(workbook_id, worksheet_id) +``` + +#### Get used range +``` +response = client.workbooks.get_used_range(workbook_id, worksheet_id) +``` + +#### Update range +``` +response1 = client.workbooks.create_session(workbook_id) +workbook_session_id = response1.data["id"] + +client.set_workbook_session_id(workbook_session_id) + +range_address = "A1:D2" +data = { + "values": [ + ["John", "Doe", "+1 305 1234567", "Miami, FL"], + ["Bill", "Gates", "+1 305 1234567", "St. Redmond, WA"], + ] +} +response2 = client.workbooks.update_range(workbook_id, worksheet_id, range_address, json=data) + +response3 = client.worbooks.close_session(workbook_id) +``` + +### Webhooks +#### Create subscription +``` +response = client.webhooks.create_subscription(change_type, notification_url, resource, expiration_datetime, client_state=None) +``` + +#### Renew subscription +``` +response = client.webhooks.renew_subscription(subscription_id, expiration_datetime) +``` + +#### Delete subscription +``` +response = client.webhooks.delete_subscription(subscription_id) +``` + + +## Requirements +- requests + +## Tests +``` +test/test.py +``` + + + +%package -n python3-microsoftgraph-python +Summary: API wrapper for Microsoft Graph written in Python +Provides: python-microsoftgraph-python +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-microsoftgraph-python +# microsoftgraph-python +Microsoft graph API wrapper for Microsoft Graph written in Python. + +## Before start +To use Microsoft Graph to read and write resources on behalf of a user, your app must get an access token from +the Microsoft identity platform and attach the token to requests that it sends to Microsoft Graph. The exact +authentication flow that you will use to get access tokens will depend on the kind of app you are developing and +whether you want to use OpenID Connect to sign the user in to your app. One common flow used by native and mobile +apps and also by some Web apps is the OAuth 2.0 authorization code grant flow. + +See [Get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth-v2-user) + +## Breaking changes if you're upgrading prior 1.0.0 +- Added structure to library to match API documentation for e.g. `client.get_me()` => `client.users.get_me()`. +- Renamed several methods to match API documentation for e.g. `client.get_me_events()` => `client.calendar.list_events()`. +- Result from calling a method is not longer a dictionary but a Response object. To access the dict response as before then call `.data` attribute for e.g `r = client.users.get_me()` then `r.data`. +- Previous API calls made through beta endpoints are now pointing to v1.0 by default. This can be changed to beta if needed with the parameter `api_version` in the client instantiation. +- Removed Office 365 endpoints as they were merged with the Microsoft Graph API. See [Office 365 APIs](https://docs.microsoft.com/en-us/previous-versions/office/office-365-api/). +## New in 1.0.0 +- You can access to [Requests library's Response Object](https://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects) for e.g. `r = client.users.get_me()` then `r.original` or the response handled by the library `r.data`. +- New Response properties `r.status_code` and `r.throttling`. +- You can pass [Requests library's Event Hooks](https://docs.python-requests.org/en/latest/user/advanced/#event-hooks) with the parameter `requests_hooks` in the client instantiation. If you are using Django and want to log in database every request made through this library, see [django-requests-logger](https://github.com/GearPlug/django-requests-logger). +- Library can auto paginate responses. Set `paginate` parameter in client initialization. Defaults to `True`. +- Better method docstrings and type hinting. +- Better library structure. +## Installing +``` +pip install microsoftgraph-python +``` +## Usage +### Client instantiation +``` +from microsoftgraph.client import Client +client = Client('CLIENT_ID', 'CLIENT_SECRET', account_type='common') # by default common, thus account_type is optional parameter. +``` + +### OAuth 2.0 +#### Get authorization url +``` +url = client.authorization_url(redirect_uri, scope, state=None) +``` + +#### Exchange the code for an access token +``` +response = client.exchange_code(redirect_uri, code) +``` + +#### Refresh token +``` +response = client.refresh_token(redirect_uri, refresh_token) +``` + +#### Set token +``` +client.set_token(token) +``` + +### Users +#### Get me +``` +response = client.users.get_me() +``` + +### Mail + +#### List messages +``` +response = client.mail.list_messages() +``` +#### Get message +``` +response = client.mail.get_message(message_id) +``` + +#### Send mail +``` +data = { + subject="Meet for lunch?", + content="The new cafeteria is open.", + content_type="text", + to_recipients=["fannyd@contoso.onmicrosoft.com"], + cc_recipients=None, + save_to_sent_items=True, +} +response = client.mail.send_mail(**data) +``` + +#### List mail folders +``` +response = client.mail.list_mail_folders() +``` + +#### Create mail folder +``` +response = client.mail.create_mail_folder(display_name) +``` + +### Notes +#### List notebooks +``` +response = client.notes.list_notebooks() +``` + +#### Get notebook +``` +response = client.notes.get_notebook(notebook_id) +``` + +#### Get notebook sections +``` +response = client.notes.list_sections(notebook_id) +``` + +#### List pages +``` +response = client.notes.list_pages() +``` + +#### Create page +``` +response = client.notes.create_page(section_id, files) +``` + +### Calendar +#### Get events +``` +response = client.calendar.list_events(calendar_id) +``` + +#### Get event +``` +response = client.calendar.get_event(event_id) +``` + +#### Create calendar event +``` +from datetime import datetime, timedelta + +start_datetime = datetime.now() + timedelta(days=1) # tomorrow +end_datetime = datetime.now() + timedelta(days=1, hours=1) # tomorrow + one hour +timezone = "America/Bogota" + +data = { + "calendar_id": "CALENDAR_ID", + "subject": "Let's go for lunch", + "content": "Does noon work for you?", + "content_type": "text", + "start_datetime": start_datetime, + "start_timezone": timezone, + "end_datetime": end_datetime, + "end_timezone": timezone, + "location": "Harry's Bar", +} +response = client.calendar.create_event(**data) +``` + +#### Get calendars +``` +response = client.calendar.list_calendars() +``` + +#### Create calendar +``` +response = client.calendar.create_calendar(name) +``` + +### Contacts +#### Get a contact +``` +response = client.contacts.get_contact(contact_id) +``` + +#### Get contacts +``` +response = client.contacts.list_contacts() +``` + +#### Create contact +``` +data = { + "given_name": "Pavel", + "surname": "Bansky", + "email_addresses": [ + { + "address": "pavelb@fabrikam.onmicrosoft.com", + "name": "Pavel Bansky" + } + ], + "business_phones": [ + "+1 732 555 0102" + ], + "folder_id": None, +} +response = client.contacts.create_contact(**data) +``` + +#### Get contact folders +``` +response = client.contacts.list_contact_folders() +``` + +#### Create contact folders +``` +response = client.contacts.create_contact_folder() +``` + +### Files +#### Get root items +``` +response = client.files.drive_root_items() +``` + +#### Get root children items +``` +response = client.files.drive_root_children_items() +``` + +#### Get specific folder items +``` +response = client.files.drive_specific_folder(folder_id) +``` + +#### Get item +``` +response = client.files.drive_get_item(item_id) +``` + +#### Download the contents of a specific item +``` +response = client.files.drive_download_contents(item_id) +``` + +#### Upload new file +``` +# This example uploads the image in path to a file in the signed-in user's drive under Pictures named upload.jpg. +response = client.files.drive_upload_new_file("/Pictures/upload.jpg", "/mnt/c/Users/i/Downloads/image1.jpg") +``` + +#### Update existing file +``` +# This example uploads the image in path to update an existing item id. +response = client.files.drive_update_existing_file(item_id, "/mnt/c/Users/i/Downloads/image2.jpg") +``` + +#### Search for files +``` +query = ".xlsx, .xlsm" +response = client.files.search_items(query) +``` + +### Workbooks +#### Create session for specific item +``` +response = client.workbooks.create_session(workbook_id) +``` + +#### Refresh session for specific item +``` +response = client.workbooks.refresh_session(workbook_id) +``` + +#### Close session for specific item +``` +response = client.workbooks.close_session(workbook_id) +``` + +#### Get worksheets +``` +response = client.workbooks.list_worksheets(workbook_id) +``` + +#### Get specific worksheet +``` +response = client.workbooks.get_worksheet(workbook_id, worksheet_id) +``` + +#### Add worksheets +``` +response = client.workbooks.add_worksheet(workbook_id) +``` + +#### Update worksheet +``` +response = client.workbooks.update_worksheet(workbook_id, worksheet_id) +``` + +#### Get charts +``` +response = client.workbooks.list_charts(workbook_id, worksheet_id) +``` + +#### Add chart +``` +response = client.workbooks.add_chart(workbook_id, worksheet_id) +``` + +#### Get tables +``` +response = client.workbooks.list_tables(workbook_id) +``` + +#### Add table +``` +response = client.workbooks.add_table(workbook_id) +``` + +#### Add column to table +``` +response = client.workbooks.create_table_column(workbook_id, worksheet_id, table_id) +``` + +#### Add row to table +``` +response = client.workbooks.create_table_row(workbook_id, worksheet_id, table_id) +``` + +#### Get table rows +``` +response = client.workbooks.list_table_rows(workbook_id, table_id) +``` + +#### Get range +``` +response = client.workbooks.get_range(workbook_id, worksheet_id) +``` + +#### Get used range +``` +response = client.workbooks.get_used_range(workbook_id, worksheet_id) +``` + +#### Update range +``` +response1 = client.workbooks.create_session(workbook_id) +workbook_session_id = response1.data["id"] + +client.set_workbook_session_id(workbook_session_id) + +range_address = "A1:D2" +data = { + "values": [ + ["John", "Doe", "+1 305 1234567", "Miami, FL"], + ["Bill", "Gates", "+1 305 1234567", "St. Redmond, WA"], + ] +} +response2 = client.workbooks.update_range(workbook_id, worksheet_id, range_address, json=data) + +response3 = client.worbooks.close_session(workbook_id) +``` + +### Webhooks +#### Create subscription +``` +response = client.webhooks.create_subscription(change_type, notification_url, resource, expiration_datetime, client_state=None) +``` + +#### Renew subscription +``` +response = client.webhooks.renew_subscription(subscription_id, expiration_datetime) +``` + +#### Delete subscription +``` +response = client.webhooks.delete_subscription(subscription_id) +``` + + +## Requirements +- requests + +## Tests +``` +test/test.py +``` + + + +%package help +Summary: Development documents and examples for microsoftgraph-python +Provides: python3-microsoftgraph-python-doc +%description help +# microsoftgraph-python +Microsoft graph API wrapper for Microsoft Graph written in Python. + +## Before start +To use Microsoft Graph to read and write resources on behalf of a user, your app must get an access token from +the Microsoft identity platform and attach the token to requests that it sends to Microsoft Graph. The exact +authentication flow that you will use to get access tokens will depend on the kind of app you are developing and +whether you want to use OpenID Connect to sign the user in to your app. One common flow used by native and mobile +apps and also by some Web apps is the OAuth 2.0 authorization code grant flow. + +See [Get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth-v2-user) + +## Breaking changes if you're upgrading prior 1.0.0 +- Added structure to library to match API documentation for e.g. `client.get_me()` => `client.users.get_me()`. +- Renamed several methods to match API documentation for e.g. `client.get_me_events()` => `client.calendar.list_events()`. +- Result from calling a method is not longer a dictionary but a Response object. To access the dict response as before then call `.data` attribute for e.g `r = client.users.get_me()` then `r.data`. +- Previous API calls made through beta endpoints are now pointing to v1.0 by default. This can be changed to beta if needed with the parameter `api_version` in the client instantiation. +- Removed Office 365 endpoints as they were merged with the Microsoft Graph API. See [Office 365 APIs](https://docs.microsoft.com/en-us/previous-versions/office/office-365-api/). +## New in 1.0.0 +- You can access to [Requests library's Response Object](https://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects) for e.g. `r = client.users.get_me()` then `r.original` or the response handled by the library `r.data`. +- New Response properties `r.status_code` and `r.throttling`. +- You can pass [Requests library's Event Hooks](https://docs.python-requests.org/en/latest/user/advanced/#event-hooks) with the parameter `requests_hooks` in the client instantiation. If you are using Django and want to log in database every request made through this library, see [django-requests-logger](https://github.com/GearPlug/django-requests-logger). +- Library can auto paginate responses. Set `paginate` parameter in client initialization. Defaults to `True`. +- Better method docstrings and type hinting. +- Better library structure. +## Installing +``` +pip install microsoftgraph-python +``` +## Usage +### Client instantiation +``` +from microsoftgraph.client import Client +client = Client('CLIENT_ID', 'CLIENT_SECRET', account_type='common') # by default common, thus account_type is optional parameter. +``` + +### OAuth 2.0 +#### Get authorization url +``` +url = client.authorization_url(redirect_uri, scope, state=None) +``` + +#### Exchange the code for an access token +``` +response = client.exchange_code(redirect_uri, code) +``` + +#### Refresh token +``` +response = client.refresh_token(redirect_uri, refresh_token) +``` + +#### Set token +``` +client.set_token(token) +``` + +### Users +#### Get me +``` +response = client.users.get_me() +``` + +### Mail + +#### List messages +``` +response = client.mail.list_messages() +``` +#### Get message +``` +response = client.mail.get_message(message_id) +``` + +#### Send mail +``` +data = { + subject="Meet for lunch?", + content="The new cafeteria is open.", + content_type="text", + to_recipients=["fannyd@contoso.onmicrosoft.com"], + cc_recipients=None, + save_to_sent_items=True, +} +response = client.mail.send_mail(**data) +``` + +#### List mail folders +``` +response = client.mail.list_mail_folders() +``` + +#### Create mail folder +``` +response = client.mail.create_mail_folder(display_name) +``` + +### Notes +#### List notebooks +``` +response = client.notes.list_notebooks() +``` + +#### Get notebook +``` +response = client.notes.get_notebook(notebook_id) +``` + +#### Get notebook sections +``` +response = client.notes.list_sections(notebook_id) +``` + +#### List pages +``` +response = client.notes.list_pages() +``` + +#### Create page +``` +response = client.notes.create_page(section_id, files) +``` + +### Calendar +#### Get events +``` +response = client.calendar.list_events(calendar_id) +``` + +#### Get event +``` +response = client.calendar.get_event(event_id) +``` + +#### Create calendar event +``` +from datetime import datetime, timedelta + +start_datetime = datetime.now() + timedelta(days=1) # tomorrow +end_datetime = datetime.now() + timedelta(days=1, hours=1) # tomorrow + one hour +timezone = "America/Bogota" + +data = { + "calendar_id": "CALENDAR_ID", + "subject": "Let's go for lunch", + "content": "Does noon work for you?", + "content_type": "text", + "start_datetime": start_datetime, + "start_timezone": timezone, + "end_datetime": end_datetime, + "end_timezone": timezone, + "location": "Harry's Bar", +} +response = client.calendar.create_event(**data) +``` + +#### Get calendars +``` +response = client.calendar.list_calendars() +``` + +#### Create calendar +``` +response = client.calendar.create_calendar(name) +``` + +### Contacts +#### Get a contact +``` +response = client.contacts.get_contact(contact_id) +``` + +#### Get contacts +``` +response = client.contacts.list_contacts() +``` + +#### Create contact +``` +data = { + "given_name": "Pavel", + "surname": "Bansky", + "email_addresses": [ + { + "address": "pavelb@fabrikam.onmicrosoft.com", + "name": "Pavel Bansky" + } + ], + "business_phones": [ + "+1 732 555 0102" + ], + "folder_id": None, +} +response = client.contacts.create_contact(**data) +``` + +#### Get contact folders +``` +response = client.contacts.list_contact_folders() +``` + +#### Create contact folders +``` +response = client.contacts.create_contact_folder() +``` + +### Files +#### Get root items +``` +response = client.files.drive_root_items() +``` + +#### Get root children items +``` +response = client.files.drive_root_children_items() +``` + +#### Get specific folder items +``` +response = client.files.drive_specific_folder(folder_id) +``` + +#### Get item +``` +response = client.files.drive_get_item(item_id) +``` + +#### Download the contents of a specific item +``` +response = client.files.drive_download_contents(item_id) +``` + +#### Upload new file +``` +# This example uploads the image in path to a file in the signed-in user's drive under Pictures named upload.jpg. +response = client.files.drive_upload_new_file("/Pictures/upload.jpg", "/mnt/c/Users/i/Downloads/image1.jpg") +``` + +#### Update existing file +``` +# This example uploads the image in path to update an existing item id. +response = client.files.drive_update_existing_file(item_id, "/mnt/c/Users/i/Downloads/image2.jpg") +``` + +#### Search for files +``` +query = ".xlsx, .xlsm" +response = client.files.search_items(query) +``` + +### Workbooks +#### Create session for specific item +``` +response = client.workbooks.create_session(workbook_id) +``` + +#### Refresh session for specific item +``` +response = client.workbooks.refresh_session(workbook_id) +``` + +#### Close session for specific item +``` +response = client.workbooks.close_session(workbook_id) +``` + +#### Get worksheets +``` +response = client.workbooks.list_worksheets(workbook_id) +``` + +#### Get specific worksheet +``` +response = client.workbooks.get_worksheet(workbook_id, worksheet_id) +``` + +#### Add worksheets +``` +response = client.workbooks.add_worksheet(workbook_id) +``` + +#### Update worksheet +``` +response = client.workbooks.update_worksheet(workbook_id, worksheet_id) +``` + +#### Get charts +``` +response = client.workbooks.list_charts(workbook_id, worksheet_id) +``` + +#### Add chart +``` +response = client.workbooks.add_chart(workbook_id, worksheet_id) +``` + +#### Get tables +``` +response = client.workbooks.list_tables(workbook_id) +``` + +#### Add table +``` +response = client.workbooks.add_table(workbook_id) +``` + +#### Add column to table +``` +response = client.workbooks.create_table_column(workbook_id, worksheet_id, table_id) +``` + +#### Add row to table +``` +response = client.workbooks.create_table_row(workbook_id, worksheet_id, table_id) +``` + +#### Get table rows +``` +response = client.workbooks.list_table_rows(workbook_id, table_id) +``` + +#### Get range +``` +response = client.workbooks.get_range(workbook_id, worksheet_id) +``` + +#### Get used range +``` +response = client.workbooks.get_used_range(workbook_id, worksheet_id) +``` + +#### Update range +``` +response1 = client.workbooks.create_session(workbook_id) +workbook_session_id = response1.data["id"] + +client.set_workbook_session_id(workbook_session_id) + +range_address = "A1:D2" +data = { + "values": [ + ["John", "Doe", "+1 305 1234567", "Miami, FL"], + ["Bill", "Gates", "+1 305 1234567", "St. Redmond, WA"], + ] +} +response2 = client.workbooks.update_range(workbook_id, worksheet_id, range_address, json=data) + +response3 = client.worbooks.close_session(workbook_id) +``` + +### Webhooks +#### Create subscription +``` +response = client.webhooks.create_subscription(change_type, notification_url, resource, expiration_datetime, client_state=None) +``` + +#### Renew subscription +``` +response = client.webhooks.renew_subscription(subscription_id, expiration_datetime) +``` + +#### Delete subscription +``` +response = client.webhooks.delete_subscription(subscription_id) +``` + + +## Requirements +- requests + +## Tests +``` +test/test.py +``` + + + +%prep +%autosetup -n microsoftgraph-python-1.1.6 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-microsoftgraph-python -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.6-1 +- Package Spec generated @@ -0,0 +1 @@ +ba7be644e5c838c6f9f7da3093d2f5df microsoftgraph_python-1.1.6.tar.gz |