Last active
January 11, 2020 06:15
-
-
Save EngineerLabShimazu/4f14317a5996f0578d772b6fdeb34a49 to your computer and use it in GitHub Desktop.
Alexa-スキル名を取得する関数
This file contains hidden or 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
_SKILL_JSON_PATH = os.getenv('SKILL_JSON', 'skill.json') | |
_SKILL_NAME = os.getenv('SKILL_NAME', '') | |
def get_skill_name(locale: str = 'ja-JP') -> str: | |
""" | |
Priority | |
1. skill.json "manifest.publishingInformation.locales.{your-locale}.name" | |
2. environment valuable from "lambda" | |
3. from python | |
Args: | |
locale: when get from skill.json | |
""" | |
if os.path.exists(_SKILL_JSON_PATH): | |
with open(_SKILL_JSON_PATH, 'r') as skill_json: | |
json_loaded = json.load(skill_json) | |
return json_loaded['manifest']['publishingInformation']['locales'][ | |
locale]['name'] | |
return _SKILL_NAME | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment