How to convert Python HTTP Post to Coldfusion HTTP Post with Authentication -
how convert python http post cf http post basic authentication?
there seems issue cf http post authentication. can't connect other side.
what missing in cf code?
from - python:
import datetime import requests auth = ('huant','vk2014') url = 'https://www.mytestdomain.com' inquiry_xml = "<inquiry> <header> <source>vk</source> </header> <data> <request_date>2014-02-25t18:48:24</request_date> <name>huan</name> <total_guests>4</total_guests> <check_in>2014-02-25</check_in> <check_out>2014-03-25</check_out> <comment><![cdata[hi u please confirm there availability , location wise close sydney city centre have 2 young children. forward hearing you. thanks,john]]></comment> <property_id>201027</property_id> <email>myemail@test.com</email> <phone_number>07747484202</phone_number> <newsletter_opt_in>0</newsletter_opt_in> <user_ip>90.221.169.227</user_ip> <point_of_sale>mydomain.com</point_of_sale> <utm_medium>mysync</utm_medium> <utm_source>huant</utm_source> <utm_campaign><![cdata[vkpost]]></utm_campaign> </data> </inquiry>" r = requests.post(url, auth=auth, data={'inquiry_xml': inquiry_xml}, verify=false) print r.status_code print r.text
to - coldfusion
<cfsavecontent variable="strxml"> <inquiry><header><source>vk</source></header><data><request_date>2014-01->31t18:48:24</request_date><name>huan</name><total_guests>4</total_guests><check_in>2014-06-20</check_in><check_out>2014-06-28</check_out><comment><![cdata[hi u please confirm]]></comment><property_id>350278</property_id><email>myemail@test.com</email><phone_number>07747484202</phone_number><newsletter_opt_in>0</newsletter_opt_in><user_ip>90.221.169.227</user_ip><point_of_sale>mydomain.com</point_of_sale><utm_medium>mysync</utm_medium><utm_source>huant</utm_source><utm_campaign>![cdata[vkpost]]</utm_campaign></data></inquiry> </cfsavecontent> <cfhttp url="https://www.mytestdomain.com" method="post" result="objget" username="huant" password="vk2014"> <cfhttpparam type="xml" value="#strxml.trim()#"/> </cfhttp> <cfdump var="#objget#">
update comments
i've tried
<cfhttparam type="formfield" name="inquiry_xml" value="#strxml.trim()#">
and still cannot authenticate. here's cfdump:
charset [empty string] errordetail i/o exception: peer not authenticated filecontent connection failure header [empty string] mimetype unable determine mime type of file. responseheader struct [empty] statuscode connection failure. status code unavailable. text yes
Comments
Post a Comment