У меня есть запрос curl, который возвращает мне ответ «200» на терминале, но когда я конвертирую его в python, используя «https://curl.trillworks.com/'», и отправляю запрос python, используя терминал, я получаю «502» в качестве ответа.
Запрос скручивания
curl 'https://www.realestate.com.au/agent/graphql' -H 'pragma: no-cache' -H 'cookie: reauid=b672655f901d00009e548c5da9000000ac250000; newRent=false; newRentRN=9145; Country=PK; optimizelyEndUserId=oeu1569477802024r0.21887500169413943; s_fid=127CB2EA3CA28871-35E6E92BBBDFFB01; s_cc=true; _sp_ses.2fe7=*; AMCVS_341225BE55BBF7E17F000101%40AdobeOrg=1; _fbp=fb.2.1569477827967.448284880; s_vi=[CS]v1|2EC62A678531288B-4000010B20000BB4[CE]; s_ecid=MCMID%7C85559102052894307862505141223124543224; _ga=GA1.3.1884427707.1569477840; _gid=GA1.3.1951175360.1569477840; AMCV_341225BE55BBF7E17F000101%40AdobeOrg=-330454231%7CMCIDTS%7C18166%7CMCMID%7C85559102052894307862505141223124543224%7CMCAAMLH-1570082640%7C3%7CMCAAMB-1570082640%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1569485018s%7CNONE%7CMCAID%7C2EC62A678531288B-4000010B20000BB4%7CMCSYNCSOP%7C411-18173%7CvVersion%7C3.1.2; QSI_HistorySession=https%3A%2F%2Fwww.realestate.com.au%2Fagent%2Fnelson-dueza-1820518~1569477845120; utag_main=v_id:016d6c2abdff001d5be0a87435cd0306900380610086e$_sn:1$_ss:0$_st:1569479645400$ses_id:1569477803524%3Bexp-session$_pn:1%3Bexp-session$vapi_domain:realestate.com.au; _sp_id.2fe7=c69741c3-0c60-467e-b0d5-9266f284c1f8.1569477818.1.1569477845.1569477818.31d2eadc-9eaa-43df-ade9-88872079a20a; mid=13175113240891315258; VT_LANG=language%3Den-US; Hint=i-09084a9758208a680; External=%2FAPPNEXUS%3D4970908581956320005%2FCASALE%3DXYxU12doM20AAGzWa6gAAACz%2526848%2F_EXP%3D1601013846%2F_exp%3D1601013848; s_sq=rea-live%3D%2526c.%2526a.%2526activitymap.%2526page%253Drea%25253Afind%252520agent%25253Aprofiles%25253Aagent%252520profile%2526link%253DSend%252520enquiry%2526region%253Dcontact-agent-form%2526pageIDType%253D1%2526.activitymap%2526.a%2526.c%2526pid%253Drea%25253Afind%252520agent%25253Aprofiles%25253Aagent%252520profile%2526pidt%253D1%2526oid%253DSend%252520enquiry%2526oidt%253D3%2526ot%253DSUBMIT' -H 'origin: https://www.realestate.com.au' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9,pt;q=0.8' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36' -H 'content-type: application/json' -H 'accept: */*' -H 'cache-control: no-cache' -H 'authority: www.realestate.com.au' -H 'referer: https://www.realestate.com.au/agent/nelson-dueza-1820518' --data-binary $'{"operationName":"SendEnquiry","variables":{"enquiry":{"id":"1820518","enquiryType":"General enquiry","propertyAddress":"","message":"Can I have your contact?","contactMethod":"EMAIL","name":"polki","phone":"","email":"dummy@ucp.edu.pk","sourceUrl":"https://www.realestate.com.au/agent/nelson-dueza-1820518","referrer":""}},"query":"mutation SendEnquiry($enquiry: ConsumerEnquiryInput\u21) {\\n sendEnquiry(enquiry: $enquiry) {\\n status\\n isValid\\n message\\n __typename\\n }\\n}\\n"}' --compressed
Запрос Python того же выше запроса скручивания
import requests
headers = {
'pragma': 'no-cache',
'cookie': 'reauid=b672655f901d00009e548c5da9000000ac250000; newRent=false; newRentRN=9145; Country=PK; optimizelyEndUserId=oeu1569477802024r0.21887500169413943; s_fid=127CB2EA3CA28871-35E6E92BBBDFFB01; s_cc=true; _sp_ses.2fe7=*; AMCVS_341225BE55BBF7E17F000101%40AdobeOrg=1; _fbp=fb.2.1569477827967.448284880; s_vi=[CS]v1|2EC62A678531288B-4000010B20000BB4[CE]; s_ecid=MCMID%7C85559102052894307862505141223124543224; _ga=GA1.3.1884427707.1569477840; _gid=GA1.3.1951175360.1569477840; AMCV_341225BE55BBF7E17F000101%40AdobeOrg=-330454231%7CMCIDTS%7C18166%7CMCMID%7C85559102052894307862505141223124543224%7CMCAAMLH-1570082640%7C3%7CMCAAMB-1570082640%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1569485018s%7CNONE%7CMCAID%7C2EC62A678531288B-4000010B20000BB4%7CMCSYNCSOP%7C411-18173%7CvVersion%7C3.1.2; QSI_HistorySession=https%3A%2F%2Fwww.realestate.com.au%2Fagent%2Fnelson-dueza-1820518~1569477845120; utag_main=v_id:016d6c2abdff001d5be0a87435cd0306900380610086e$_sn:1$_ss:0$_st:1569479645400$ses_id:1569477803524%3Bexp-session$_pn:1%3Bexp-session$vapi_domain:realestate.com.au; _sp_id.2fe7=c69741c3-0c60-467e-b0d5-9266f284c1f8.1569477818.1.1569477845.1569477818.31d2eadc-9eaa-43df-ade9-88872079a20a; mid=13175113240891315258; VT_LANG=language%3Den-US; Hint=i-09084a9758208a680; External=%2FAPPNEXUS%3D4970908581956320005%2FCASALE%3DXYxU12doM20AAGzWa6gAAACz%2526848%2F_EXP%3D1601013846%2F_exp%3D1601013848; s_sq=rea-live%3D%2526c.%2526a.%2526activitymap.%2526page%253Drea%25253Afind%252520agent%25253Aprofiles%25253Aagent%252520profile%2526link%253DSend%252520enquiry%2526region%253Dcontact-agent-form%2526pageIDType%253D1%2526.activitymap%2526.a%2526.c%2526pid%253Drea%25253Afind%252520agent%25253Aprofiles%25253Aagent%252520profile%2526pidt%253D1%2526oid%253DSend%252520enquiry%2526oidt%253D3%2526ot%253DSUBMIT',
'origin': 'https://www.realestate.com.au',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9,pt;q=0.8',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
'content-type': 'application/json',
'accept': '*/*',
'cache-control': 'no-cache',
'authority': 'www.realestate.com.au',
'referer': 'https://www.realestate.com.au/agent/nelson-dueza-1820518',
}
data = '{"operationName":"SendEnquiry","variables":{"enquiry":{"id":"1820518","enquiryType":"General enquiry","propertyAddress":"","message":"Can I have your contact?","contactMethod":"EMAIL","name":"polki","phone":"","email":"ahmadarshi@ucp.edu.pk","sourceUrl":"https://www.realestate.com.au/agent/nelson-dueza-1820518","referrer":""}},"query":"mutation SendEnquiry($enquiry: ConsumerEnquiryInput\\u21) {\\\\n sendEnquiry(enquiry: $enquiry) {\\\\n status\\\\n isValid\\\\n message\\\\n __typename\\\\n }\\\\n}\\\\n"}'
response = requests.post('https://www.realestate.com.au/agent/graphql', headers=headers, data=data)