将带有encode的cURL调用转换为python请求

时间:2016-08-06 15:02:14

标签: python curl

现在,在此之前被标记为重复和downvoted,我已经尝试了所有其他链接(如下所示),但他们没有帮助。

converting curl call to python requests

Convert cURL request to Python-Requests request

我正在制作的cURL调用是(Theres $ interpolation,因为它在.sh文件中)

COOKIE_JAR=./program.cookies
LOGIN_URL= 'URL'
USER_ID = 'USERID'
PASSWORD = 'password'
VIEWSTATE = 'long string of text'

$(curl"$LOGIN_URL"-L -b "$COOKIE_JAR" -c "$COOKIE_JAR"
--data-urlencode "__VIEWSTATE=$viewstate" --data-urlencode "userid=$USER_ID" 
--data-urlencode "password=$PASSWORD") || printf >2 "failed to get token:\n%s" 
"$token" && printf "your token is:\n%s\n" "$token"

我如何将其转换为python请求表单?任何帮助将不胜感激!! :)

1 个答案:

答案 0 :(得分:0)

所以如果有人需要的话,我设法让它运转起来:

Array
(
    [Q)] => EHAA/QARLT/I /NBO/E /000/999/5155N00430E073
    [A)] => EHAA
    [B)] => 1605260001
    [C)] => 1608260900 EST
    [E)] => REF AIP NETHERLANDS ENR 3.2 UT601 ADD TO ROUTE REMARKS: NOT AVBL FOR TRAFFIC DEP/ARR ETNG, EDDK AND ETNN DURING THE OPENING OF EHEH 0600-2300 (0500-2200). THESE FLIGHTS WILL HAVE TO REROUTE.
)

毕竟不需要cookies!