-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.py
More file actions
33 lines (28 loc) · 862 Bytes
/
welcome.py
File metadata and controls
33 lines (28 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
from parse_response import parse_response
def get_event_information() -> object:
url = 'https://pythoncanarias.es/api/v1/events/pydaygc19/'
response = requests.get(url)
data = response.json()
return data
def welcome_action(req: object = None) -> object:
"""welcome action
"""
event_information = get_event_information()
result = {
"fulfillmentMessages": [
{
"payload": {
"telegram": {
"text": f"Hola, bienvenido. \n{event_information['result']['description']}",
"parse_mode": "Markdown"
}
},
"platform": "TELEGRAM",
},
],
}
response = parse_response(result)
return response