Python Forum
multiple values as parameters to POST command..
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple values as parameters to POST command..
#8
Hi,

tried as you suggested with requests.post instead of urllib2. following is the tracebak
and sorry while pasting i missed that ] which you have mentioned..

Traceback (most recent call last):
File "/home/user/script/ABSlack1.py", line 39, in <module>
slack_msg = json.loads(response)
File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

This is what code change which i tried as per you suggestions

slack_msg = json.loads(response)
slack_msg['channel'] = SLACK_CHANNEL
slack_json = json.dumps(slack_msg)
#req = Request(HOOK_URL, slack_json)
response = requests.post(
    webhook_url, data=slack_json,
    headers={'Content-Type': 'application/json'})
Reply


Messages In This Thread
RE: multiple values as parameters to POST command.. - by onenessboy - Feb-20-2018, 01:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  __init__() got multiple values for argument 'schema' dawid294 4 1,887 Jan-03-2024, 09:42 AM
Last Post: buran
  How to combine multiple column values into 1? cubangt 15 2,631 Aug-11-2022, 08:25 PM
Last Post: cubangt
  Substitue multiple substrings in one command Pavel_47 0 800 Jul-18-2022, 01:24 PM
Last Post: Pavel_47
  function accepts infinite parameters and returns a graph with those values edencthompson 0 812 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  Function - Return multiple values tester_V 10 4,319 Jun-02-2021, 05:34 AM
Last Post: tester_V
  How to input & output parameters from command line argument shantanu97 1 2,506 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Xlsxwriter: Create Multiple Sheets Based on Dataframe's Sorted Values KMV 2 3,441 Mar-09-2021, 12:24 PM
Last Post: KMV
  Looking for help in Parse multiple XMLs and update key node values and generate Out.. rajesh3383 0 1,847 Sep-15-2020, 01:42 PM
Last Post: rajesh3383
  Assigning multiple values using tuple sivacg 2 2,225 Aug-06-2020, 10:29 PM
Last Post: perfringo
  Function parameters and values as string infobound 1 1,728 Jul-24-2020, 04:28 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020