Closed franklingu closed 6 years ago
res = ses.post('http://www.cninfo.com.cn/cninfo-new/data/download', files={'K_code': '', 'market': 'sz', 'type': 'lrb', 'code': '000001', 'orgid': 'gssz0000001', 'minYear': '1991', 'maxYear': '2017
...: ', 'hq_code': '', 'hq_k_code': '', 'cw_code': '', 'cw_k_code': ''})
In [48]: print(res.request.body.decode('utf-8'))
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="K_code"; filename="K_code"
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="market"; filename="market"
sz
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="type"; filename="type"
lrb
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="code"; filename="code"
000001
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="orgid"; filename="orgid"
gssz0000001
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="minYear"; filename="minYear"
1991
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="maxYear"; filename="maxYear"
2017
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="hq_code"; filename="hq_code"
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="hq_k_code"; filename="hq_k_code"
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="cw_code"; filename="cw_code"
--9b0aa7ab7bbb498a8147d6423bcfeeee
Content-Disposition: form-data; name="cw_k_code"; filename="cw_k_code"
--9b0aa7ab7bbb498a8147d6423bcfeeee--
In [50]: res = ses.post('http://www.cninfo.com.cn/cninfo-new/data/download', files={'K_code': (None, ''), 'market': (None, 'sz'), 'type': (None, 'lrb'), 'code': (None, '000001'), 'orgid': (None, 'gssz000000
...: 1'), 'minYear': (None, '1991'), 'maxYear': (None, '2017'), 'hq_code': (None, ''), 'hq_k_code': (None, ''), 'cw_code': (None, ''), 'cw_k_code': (None, '')})
In [54]: print(res.request.body.decode('utf-8'))
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="K_code"
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="market"
sz
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="type"
lrb
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="code"
000001
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="orgid"
gssz0000001
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="minYear"
1991
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="maxYear"
2017
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="hq_code"
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="hq_k_code"
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="cw_code"
--0670e2aae4bf48029d4d4634760325f3
Content-Disposition: form-data; name="cw_k_code"
--0670e2aae4bf48029d4d4634760325f3--
https://stackoverflow.com/questions/23120974/python-requests-post-multipart-form-data-without-filename-in-http-request https://stackoverflow.com/questions/12385179/how-to-send-a-multipart-form-data-with-requests-in-python https://github.com/requests/requests/issues/1081