Skip to content

Instantly share code, notes, and snippets.

@EngineerLabShimazu
Last active January 11, 2020 06:15
Show Gist options
  • Save EngineerLabShimazu/4f14317a5996f0578d772b6fdeb34a49 to your computer and use it in GitHub Desktop.
Save EngineerLabShimazu/4f14317a5996f0578d772b6fdeb34a49 to your computer and use it in GitHub Desktop.
Alexa-スキル名を取得する関数
_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