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..
#6
sorry i did not post entire response..

While conn is environment variable which is having connecting details

here it is
{
    "Reservations": [
        {
            "Instances": [
                {
                    "Monitoring": {
                        "State": "disabled"
                    },
                    "PublicDnsName": "",
                    "StateReason": {
                        "Message": "Client.UserInitiatedShutdown: User initiated shutdown",
                        "Code": "Client.UserInitiatedShutdown"
                    },
                    "State": {
                        "Code": 80,
                        "Name": "stopped"
                    },
                    "EbsOptimized": false,
                    "LaunchTime": "2018-02-08T10:37:36.000Z",
                    "PrivateIpAddress": "xx.xx.x.xxx",
                    "ProductCodes": [],
                    "VpcId": "xx-xxxx",
                    "StateTransitionReason": "User initiated (2018-02-08 11:13:34 GMT)",
                    "InstanceId": "xxxxxxxx",
                    "EnaSupport": true,
                    "ImageId": "xx-xxxxx",
                    "PrivateDnsName": "xxxxxxx",
                    "KeyName": "xxxxx",
                    "SecurityGroups": [
                        {
                            "GroupName": "xxxxxx",
                            "GroupId": "xxxxxxx"
                        }
                    ],
                    "ClientToken": "",
                    "SubnetId": "xxxx-xxxx",
                    "InstanceType": "t2.micro",
                    "NetworkInterfaces": [
                        {
                            "Status": "in-use",
                            "MacAddress": "xxxxxxx",
                            "SourceDestCheck": true,
                            "VpcId": "xxxxx",
                            "Description": "Primary network interface",
                            "NetworkInterfaceId": "xxxx",
                            "PrivateIpAddresses": [
                                {
                                    "PrivateDnsName": "xxxxxxx",
                                    "Primary": true,
                                    "PrivateIpAddress": "xx.xx.xx.xxx"
                                }
                            ],
                            "PrivateDnsName": "xxxxxx",
                            "Attachment": {
                                "Status": "xxx",
                                "DeviceIndex": 0,
                                "DeleteOnTermination": true,
                                "AttachmentId": "xxxxxx",
                                "AttachTime": "2017-12-28T17:24:50.000Z"
                            },
                            "Groups": [
                                {
                                    "GroupName": "xx",
                                    "GroupId": "xx-xxxx"
                                }
                            ],
                            "Ipv6Addresses": [],
                            "OwnerId": "xxxxxxx",
                            "SubnetId": "subnet-xxxxx",
                            "PrivateIpAddress": "xx.xx.x.x"
                        }
                    ],
                    "SourceDestCheck": true,
                    "Placement": {
                        "Tenancy": "default",
                        "GroupName": "",
                        "AvailabilityZone": "xx-xx-xx"
                    },
                    "Hypervisor": "xen",
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/xx/xx",
                            "Ebs": {
                                "Status": "attached",
                                "DeleteOnTermination": true,
                                "VolumeId": "vol-xxxxxxxx",
                                "AttachTime": "2017-12-28T17:24:51.000Z"
                            }
                        }
                    ],
                    "Architecture": "x86_64",
                    "RootDeviceType": "ebs",
                    "RootDeviceName": "/dev/xvda",
                    "VirtualizationType": "hvm",
                    "Tags": [
                        {
                            "Value": "xxxx",
                            "Key": "Name"
                        }
                    ],
                    "AmiLaunchIndex": 0
                }
            ],
            "ReservationId": "00000f4510a2551",
            "Groups": [],
            "OwnerId": "xxxxxxxx"
        }
        
}
This is the traceback

Traceback (most recent call last):
File "/home/user/script/ABSlack1.py", line 43, in <module>
req = Request(HOOK_URL, json.dumps(response))
File "/usr/lib64/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Reservation:r-00000f4510a2551 "not JSON serializable
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  __init__() got multiple values for argument 'schema' dawid294 4 2,265 Jan-03-2024, 09:42 AM
Last Post: buran
  How to combine multiple column values into 1? cubangt 15 2,809 Aug-11-2022, 08:25 PM
Last Post: cubangt
  Substitue multiple substrings in one command Pavel_47 0 831 Jul-18-2022, 01:24 PM
Last Post: Pavel_47
  function accepts infinite parameters and returns a graph with those values edencthompson 0 855 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  Function - Return multiple values tester_V 10 4,438 Jun-02-2021, 05:34 AM
Last Post: tester_V
  How to input & output parameters from command line argument shantanu97 1 2,552 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Xlsxwriter: Create Multiple Sheets Based on Dataframe's Sorted Values KMV 2 3,483 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,872 Sep-15-2020, 01:42 PM
Last Post: rajesh3383
  Assigning multiple values using tuple sivacg 2 2,265 Aug-06-2020, 10:29 PM
Last Post: perfringo
  Function parameters and values as string infobound 1 1,757 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