Spaces:
Runtime error
Runtime error
Download src/whatsapp_integration/gathering_data.py from Viraj2307/Analytics-Bot: direct link, hf CLI and curl.
- Browser
- Download file 660 Bytes
-
https://huggingface.co/spaces/Viraj2307/Analytics-Bot/resolve/main/src/whatsapp_integration/gathering_data.py
- Command line
-
hf download hf://spaces/Viraj2307/Analytics-Bot/src/whatsapp_integration/gathering_data.py
-
curl -L -o gathering_data.py https://huggingface.co/spaces/Viraj2307/Analytics-Bot/resolve/main/src/whatsapp_integration/gathering_data.py
660 Bytes
| def gathering_data(res): | |
| try: | |
| phone_number = res["entry"][0]["changes"][0]["value"]["messages"][0]["from"] | |
| except BaseException: | |
| return None | |
| try: | |
| text = res["entry"][0]["changes"][0]["value"]["messages"][0]["text"]["body"] | |
| try: | |
| text = int(text) | |
| except BaseException: | |
| pass | |
| except BaseException: | |
| try: | |
| text = res["entry"][0]["changes"][0]["value"]["messages"][0]["button"][ | |
| "text" | |
| ] | |
| except BaseException: | |
| text = res["entry"][0]["changes"][0]["value"]["messages"][0]["location"] | |
| return phone_number, str(text) | |