kakao i openbuilder skill response template builder β for python π
νμ΄μ¬μμ μΉ΄μΉ΄μ€ i μ€νλΉλμ μλ΅ νμ λ³ JSON ν¬λ§·μ μμ±νλ λꡬ μ λλ€.
π μ€νλΉλ λμλ§μ λͺ¨λ μλ΅ νμ
λ³ JSON ν¬λ§·μ λ§λ€ μ μμ΅λλ€. λͺ¨λ λ€ ν
μ€νΈ ν΄λ΄€μ΄μ! π tests/test_builder.py
λ₯Ό μ°Έκ³ !
β SkillResponseBuilder
λ₯Ό μ΄μ©ν΄μ μνλλλ‘ μ΄κ²μ κ² μμΈ λλ΅μ λ§λ€ μ μμ΅λλ€!
π νμ΄μ¬μ local λ³μλ₯Ό μ΄μ©ν΄μ μ½λκ° μμ² μ§§μμ! κ³ μΉκΈ° μ½λ€λ λ»μ΄μ£ .
$ pip install kakaosb
- SimpleText
from kakaosb import SkillResponseBuilder, SimpleText
sb = SkillResponseBuilder([SimpleText('Hello Kakao!')])
res_dict = sb.to_dict() # μ¬μ νμ λ³ν
res_json = sb.to_json(indent=4) # json νμ λ³ν
- λ² μ΄μ§ μΉ΄λ
from kakaosb import SkillResponseBuilder, BasicCard, Thumbnail, Profile, Social, MessageButton, WeblinkButton
sb = SkillResponseBuilder()
basicCard = BasicCard(
thumbnail=Thumbnail('http://k.kakaocdn.net/dn/83BvP/bl20duRC1Q1/lj3JUcmrzC53YIjNDkqbWK/i_6piz1p.jpg'),
title='보물μμ',
description='보물μμ μμλ λκ° μμκΉ',
profile=Profile('보물μμ', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT4BJ9LU4Ikr_EvZLmijfcjzQKMRCJ2bO3A8SVKNuQ78zu2KOqM'),
social=Social(1238, 8, 780),
buttons=[
MessageButton('μ΄μ΄λ³΄κΈ°', 'μ§μ! μ°λ¦¬κ° μ°Ύλ 보물μ
λλ€'),
WeblinkButton('ꡬ경νκΈ°', 'https://e.kakao.com/t/hello-ryan')
])
sb.append(basicCard)
res_dict = sb.to_dict() # μ¬μ νμ λ³ν
res_json = sb.to_json(indent=4) # json νμ λ³ν
- mix
from kakaosb import SkillResponseBuilder, SimpleText, SimpleImage
sb = SkillResponseBuilder()
sb.append(SimpleText('Hello Kakao!'))
sb.append(SimpleImage('http://k.kakaocdn.net/dn/83BvP/bl20duRC1Q1/lj3JUcmrzC53YIjNDkqbWK/i_6piz1p.jpg', '보물μμμ
λλ€'))
sb.append(SimpleText('Bye Bye π§€'))
res_dict = sb.to_dict() # μ¬μ νμ λ³ν
res_json = sb.to_json(indent=4) # json νμ λ³ν