[tufin]Caution on posting xml to tufin securechange

You need to remember to encode your xml body to utf-8, otherwise the requests module will throw in weird exceptions like this: 2018-05-04 16:53:57,068 ERROR:'NoneType' object is not callable
2018-05-04 16:54:21,816 ERROR:too many values to unpack (expected 2)
2018-05-04 17:22:20,238 ERROR:'NoneType' object is not callable
2018-05-04 17:39:07,737 ERROR:'NoneType' object is not callable
2018-05-04 17:42:03,475 ERROR:'NoneType' object is not callable
2018-05-04 17:45:56,628 ERROR:'NoneType' object is not callable

Do not use prettify() as the xml body, using prettify() method will cause \n to be added on every line, tufin SC will complain about workflow not found or anything not found.

You need to post like this:

    try:
        response = tufin_sc.post(TUFIN_BASE + TICKET_URI, data=base_content.encode('utf-8'))
        print(response.text)
    except Exception as e:
        logging.error(e)
        exit(1)
Advertisements
This entry was posted in Python, Scripting and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s