skip to Main Content

Python JSON returning None value (Telegram API)

I am trying to return the user id of new members who join a telegram group, I can get the JSON data but I cannot retrieve values from a level deeper: code: def new_chat_members(self, bot, update): print(update) print(update['message']) print(update['message']['from']) print(update['message'].get('from'))…

VIEW QUESTION

I coded my telegram bot (in python) prompting user to send an image. How do I make sure users only send image and nothing else? – Telegram API

def process_color_step(message): chat_id = message.chat.id product.color = message.text msg = bot.send_message(chat_id, 'ok, send me a photo of your phone') bot.register_next_step_handler(msg,process_image_step) def process_image_step(message): chat_id = message.chat.id product.image = message.photo[1].file_id msg = bot.send_message(chat_id, 'Ok, send me a description of your phone?') bot.register_next_step_handler(msg,process_description_step)…

VIEW QUESTION

Elastalert deployment failed – CentOS

I have installed elastalert on Centos 7.6 and while starting the elastalert receiving the following error. [root@e2e-27-36 elastalert]# python -m elastalert.elastalert --verbose --rule example_rules/example_frequency.yaml Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File…

VIEW QUESTION

I am getting an error when using the facebook api

File "SAMPLE_CODE.py", line 21, in <module> from facebookads.adobjects.adaccount import AdAccount File "/usr/local/lib/python3.7/site-packages/facebookads/adobjects/adaccount.py", line 1582 def get_insights(self, fields=None, params=None, async=False, batch=None, pending=False): ^ SyntaxError: invalid syntax I am trying to use the Facebook API and I am getting this error. Not…

VIEW QUESTION
Back To Top
Search