Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- from constants import *
- from colorama import Fore
- from xml.dom.minidom import parseString
- from http.client import HTTPSConnection as conn
- def request_data(connection, url, method, payload):
- connection.request(method, url, payload, headers)
- decode = connection.getresponse().read().decode('utf-8')
- return parseString(decode).toprettyxml()
- start = time.time()
- endpoint = '/endpoint'
- method = 'POST'
- pcf_connection = conn('service-1.com')
- mule_connection = conn('service-2.com')
- for i in payload:
- pcf = request_data(pcf_connection, endpoint, method)
- mule = request_data(mule_connection, endpoint, method)
- if pcf != mule:
- print('descrepancy found:')
- for i, k in zip(pcf.splitlines(), mule.splitlines()):
- if i != k:
- print(Fore.GREEN + i)
- print(Fore.RED + k)
- pcf_connection.close()
- mule_connection.close()
- print(Fore.WHITE + 'done. time: ', round(time.time() - start, 2), 's', sep='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement