-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a89d6a4
commit 98c61de
Showing
25 changed files
with
943 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
sdk/maps/azure-maps-render/samples/async_samples/sample_get_copyright_caption_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# coding: utf-8 | ||
|
||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
|
||
""" | ||
FILE: sample_get_copyright_caption_async.py | ||
DESCRIPTION: | ||
This sample demonstrates how to serve copyright information for Render Tile | ||
service. In addition to basic copyright for the whole map, API is serving | ||
specific groups of copyrights for some countries. | ||
USAGE: | ||
python sample_get_copyright_caption_async.py | ||
Set the environment variables with your own values before running the sample: | ||
- AZURE_SUBSCRIPTION_KEY - your subscription key | ||
""" | ||
|
||
import asyncio | ||
import os | ||
import json | ||
|
||
def to_json(self): | ||
return json.dumps( | ||
self, | ||
default=lambda o: o.__dict__, | ||
sort_keys=True, | ||
indent=4 | ||
) | ||
|
||
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") | ||
|
||
async def get_copyright_caption_async(): | ||
# [START get_copyright_caption_async] | ||
from azure.core.credentials import AzureKeyCredential | ||
from azure.maps.render.aio import MapsRenderClient | ||
|
||
maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key)) | ||
|
||
async with maps_render_client: | ||
result = await maps_render_client.get_copyright_caption() | ||
|
||
print("Get copyright caption result:") | ||
print(result) | ||
print("------------------------------") | ||
print("Get copyright caption result in Json format:") | ||
print(to_json(result)) | ||
# [END get_copyright_caption_async] | ||
|
||
if __name__ == '__main__': | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_copyright_caption_async()) |
Oops, something went wrong.