网站technopoint.ru上的POST数据出现问题

时间:2019-04-26 03:20:08

标签: python ajax post multipartform-data

我正在Windows上使用Python 3进行编码。

我正在尝试解析一个站点,并且在用Python构成POST(XHR)时出现问题,以请求跟随链接。从网络中的Chrome DevTools找到了发件人数据。

Requset URL:

'https://technopoint.ru/catalog/product/get-product-list-blocks/'

源(表单数据)像这样:

------WebKitFormBoundaryIA5Quba6l0rrGlP9
Content-Disposition: form-data; name="products"

["8e9e876c-8de8-11e7-938d-00155d03330d","7ea0ed6c-1cf2-11e8-9dc5-00155d03330d","44d27152-26fc-11e6-922e-00155d033307","1839fee2-235e-11e7-924e-00155d03330d","5dcc6350-1cf2-11e8-9dc5-00155d03330d","1e8a7226-1cf2-11e8-9dc5-00155d03330d","9ee63819-8de8-11e7-938d-00155d03330d","8c86a61e-5a84-11e5-8123-00155d03361b","70952db9-8de8-11e7-938d-00155d03330d","44d27153-26fc-11e6-922e-00155d033307","f10d3fea-bbcf-11e8-9547-00155d03330d","68254ce2-993c-11e8-9547-00155d03330d","0101843a-dcbc-11e8-a207-00155df1b805","7b573bfa-993c-11e8-9547-00155d03330d","34666adb-66e7-11e7-a17a-00155d03330d","3918c985-86d1-11e2-8583-00155d030b1f","d8c20ff1-d03e-11df-8f0d-001517c526f0","6b86bdd9-f787-11e8-a205-00155d03332b","2d902c57-6f36-11e2-b24e-00155d030b1f","97da82b6-29a6-11e9-a206-00155d03332b"]
------WebKitFormBoundaryIA5Quba6l0rrGlP9--

推荐链接是: 'https://technopoint.ru/catalog/17a89b4f16404e77/zvukovye-karty/'

这周我尝试在python lib上找到一些解决方案

我发现它是边界为------WebKitFormBoundarybIUe0zIlcuWNnFzG的文件

我尝试将其放在文件头中,我不知道该位置。

payload = { 
        u'products': [  #json.JSONEncoder(search), #.dumps(search),
        u'616e57cc-d027-11e8-a206-00155df1b805',
        u'5791d808-46a5-11e9-a206-00155d03332b',
        u'4d2ba0ed-03e4-11e8-80a7-00155d03330d',
        u'173b85a8-7e3e-11e7-a5d2-00155d03330d',
        u'2310b40e-accd-11e8-9547-00155d03330d',
        u'626dc329-7e3f-11e7-a5d2-00155d03330d',
        u'515203c0-7e3e-11e7-a5d2-00155d03330d',
        u'79254988-7db0-11e7-97a1-00155d03330d',
        u'339295d6-7e3f-11e7-a5d2-00155d03330d',
        u'320022b4-7e3c-11e7-a5d2-00155d03330d',
        u'aaebbbb2-accc-11e8-9547-00155d03330d',
        u'6755d632-46a7-11e9-a206-00155d03332b',
        u'21b660ce-60db-11e1-aa31-001517c526f0',
        u'45903e49-cd1a-11e4-907b-00155d03361b',
        u'45903e4a-cd1a-11e4-907b-00155d03361b',
        u'983984f8-7e3d-11e7-a5d2-00155d03330d',
        u'6c7d0b4a-49fd-11e5-be92-00155d03361b',
        u'8278306f-5691-11e5-91a6-00155d03361b',
        u'a460946e-1392-11e3-a0ce-00155d030b1f',
        u'3bbbb635-46a7-11e9-a206-00155d03332b']

    } 

print(payload)
headers['Content-Type']='multipart/form-data;boundary=------WebKitFormBoundarybIUe0zIlcuWNnFzG'
#cj = browser_cookie3.chrome(domain_name='.nix.ru') #Try Cookie From Chrome
sess.headers=headers
#sess.cookies=cj
response = sess.post(url,files=payload,headers=headers)

最后一个我的代码返回

  

响应400个错误请求

0 个答案:

没有答案