Home>

Hello everyone! With the help of Fiddler, I caught the following outgoing request (RAW):

POST https://account.rejoner.com/api/v1/user/signup HTTP/1.1
Host: account.rejoner.com
Connection: keep-alive
content length: 2663
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"
sec-ch-ua-mobile: ?1
User-Agent: Mozilla/5.0 (Linux; Android 7.1.2; SM-N975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.104 Mobile Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryKXAn4Aur4wlfjACa
Accept: application/json, text/plain, */*
X-Requested-With: XMLHttpRequest
X-Request-Id: 86c3d6b-d649-f6e2-a9f4-968c35b483d5
sec-ch-ua-platform: "Android"
Origin: https://account.rejoner.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://account.rejoner.com/signup?from=main_m_touch
Accept-Encoding: gzip, deflate, br
Accept-Language: ru-RU,ru;q=0.9
Cookies:
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="extended"
true
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="more_password_strength"
one
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="context"
sign up
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="browser"
{"screen":{"availWidth":"854","availHeight":"480","width":"854","height":"480","colorDepth":"24","pixelDepth": "24","availLeft":"0","availTop":"0"},
"navigator":{"vendorSub":"","productSub":"20030107","vendor":"Google Inc.","maxTouchPoints":"5","doNotTrack":"inaccessible","hardwareConcurrency": "4","cookieEnabled":"true","appCodeName":"Mozilla","appName":"Netscape","appVersion":"5.0 (Linux; Android 7.1.2; SM-N975F) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/96.0.4664.104 Mobile Safari/537.36","platform":"Linux i686","product":"Gecko","userAgent":"Mozilla/5.0 (Linux; Android 7.1.2; SM -N975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.104 Mobile Safari/537.36","language":"en-US","onLine":"true","webdriver":"false"," pdfViewerEnabled":"false","deviceMemory":"4"},
"flash":{"version":"inaccessible"}}
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="from"
main_m_touch
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="sent_me_ads"
true
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="sent_me_ads_common"
true
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="name"
{"first":"Olya","last":"Monolya"}
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="birthday"
{"day":2,"month":4,"year":1986}
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="sex"
female
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="login"
monovaolya12
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="domain"
rejoner.com
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="password"
a=a=a=b=b=b=
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="restore"
{"secret":"-","secret_answer":"-","additional_email":"[email protected]"}
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="htmlencoded"
false
------WebKitFormBoundaryKXAn4Aur4wlfjACa
Content-Disposition: form-data; name="utm"
{"source":"","medium":"","campaign":"","term":"","content":""}
------WebKitFormBoundaryKXAn4Aur4wlfjACa--

The first part of the RAW is the headers, the second is the content of the form, well, that's pretty obvious.
If I repeat sending this request through Fiddler itself, then the server returns me a positive response. But if I try to send it throughrequests, it returns an error.
If I convert the first and second parts to their respective dictionaries and substitute in requests.post(url, data=data, headers=headers), then the server gives an error. If I substitute the second part in the form, but already in the formfiles=data(since the form is stillmultipart/form-data), then the interpreter itself swears thatfilesit should bebytes, but notdict.

In general, the question is simple. How to repeat the submitted query exactly usingrequests?

Please edit the question to reflect the specific problem with enough detail to be able to give an adequate answer.

Дух сообщества2022-01-23 16:10:34

Give all the errors that you mention explicitly in your question, you can edit it.

CrazyElf2022-01-23 16:16:56