Feb-19-2018, 09:20 AM
Hi Experts,
I need some help.
What I actually need is to post some server status to slack channel with python
The below is the example code i am trying
I tried different methods and ended up with some errors like " too many values to unpack, Json not serializable etc
Can you some one guide me or assist me to get multiple values to be posted on slack channel
Thank you very munch in advance
best regards
ASP
I need some help.
What I actually need is to post some server status to slack channel with python
The below is the example code i am trying
import json import requests # Set the webhook_url to the one provided by Slack when you create the webhook at https://my.slack.com/services/new/incoming-webhook/ webhook_url = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX' slack_data = {'text': "Hello from python"} response = requests.post( webhook_url, data=json.dumps(slack_data), headers={'Content-Type': 'application/json'} ) if response.status_code != 200: raise ValueError( 'Request to slack returned an error %s, the response is:\n%s' % (response.status_code, response.text) )Though above code is working fine. But I want to pass multiple values in slack_data as above example is having only one data value is being posted on slack. But I want to mention multiple values at line no 6
I tried different methods and ended up with some errors like " too many values to unpack, Json not serializable etc
Can you some one guide me or assist me to get multiple values to be posted on slack channel
Thank you very munch in advance
best regards
ASP