复制chrome请求头以及Copy as cURL直接转成python代码

2024-06-10 20:38

本文主要是介绍复制chrome请求头以及Copy as cURL直接转成python代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

python爬虫经常需要复制浏览器请求头,之前都是用pycharm批量替换。今天想看看有啥方便的方法没。结果发现了超出预期的东西。chrome的Copy as cURL 和curl to python。

下图是Copy as cURL,python爬取动态网页时经常需要寻找真正的接口然后利用参数构造请求。

以https://fr.news.yahoo.com/politique/这个网站为例

复制过来是这么一坨:

curl 'https://fr.news.yahoo.com/_td/api/resource?bkt=news-FR-fr-FR-def&crumb=6a5SY1XJFm0&device=desktop&ecma=modern&feature=cacheContentCanvas%2CenableCCPAFooter%2CenableGDPRFooter%2CenableCMP%2CenableConsentData%2Clivecoverage%2CnewContentAttribution%2CnewLogo%2CrivendellMigration%2CvideoDocking%2Cuserintent%2CenableReconsent%2CnewsVideo%2CncpStream%2CnewLayout%2CdeferModalCluster%2CclusterBackfill%2ChideLREC2Singleton%2CsponsoredAds&intl=fr&lang=fr-FR&partner=none&prid=77t6k31fbqkjt&region=FR&site=news&tz=Asia%2FShanghai&ver=0.0.12105301' \-H 'authority: fr.news.yahoo.com' \-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' \-H 'x-requested-with: XMLHttpRequest' \-H 'content-type: application/json' \-H 'accept: */*' \-H 'origin: https://fr.news.yahoo.com' \-H 'sec-fetch-site: same-origin' \-H 'sec-fetch-mode: cors' \-H 'sec-fetch-dest: empty' \-H 'referer: https://fr.news.yahoo.com/politique/' \-H 'accept-language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6' \-H 'cookie: B=et65l8pfbq5gs&b=3&s=qj; APID=UP604a2bca-95c9-11ea-a924-06d17d12d6d8; EuConsent=BOzYt24OzYt25AOABCFRC7uAAAAtl6__f_97_8_v2ddvduz_Ov_j_c__3XW8fPZvcELzhK9Meu_2xzd4u9wNRM5wckx87eJrEso5czISsG-RMod_zt__3ziX9oxPowEc9rz3nbEw6vs2v-ZzBCGJ_Iw; A1=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0; A3=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0; GUC=AQABAQFevl1e-kIfkASh; A1S=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0&j=WORLD; APIDTS=1589454807; EuConsent=BOzYt24OzZTj9AOABCFRC7uAAAAtl6__f_97_8_v2ddvduz_Ov_j_c__3XW8fPZvcELzhK9Meu_2xzd4u9wNRM5wckx87eJrEso5czISsG-RMod_zt__3ziX9oxPowEc9rz3nbEw6vs2v-ZzBCGJ_Iw; cmp=v=28&t=1589465728&j=1&o=106' \--data-binary '{"requests":{"g0":{"resource":"StreamService","operation":"read","params":{"ui":{"comments":true,"comments_offnet":true,"dispatch_content_store":true,"editorial_featured_count":1,"image_quality_override":true,"link_out_allowed":true,"needtoknow_template":"filmstrip","ntk_bypassA3c":true,"pubtime_maxage":-1,"relative_links":true,"show_comment_count":true,"smart_crop":true,"storyline_count":2,"storyline_enabled":true,"storyline_min":2,"summary":true,"thumbnail_size":100,"tiles":{"allowPartialRows":true,"doubleTallStart":0,"featured_label":false,"gradient":false,"height":175,"resizeImages":false,"textOnly":[{"backgroundColor":"#fff","foregroundColor":"#000"}],"width_max":300,"width_min":200},"view":"mega","editorial_content_count":6,"editorial_content_min":0,"enable_lead_fallback_image":true,"lead_fallback_image":"https://s.yimg.com/dh/ap/my/themes/dark_1366x854_01_prog.jpg","roundup":true},"category":"LISTID:5763faba-6a6b-45aa-bd37-37ca830f7660","forceJpg":true,"releasesParams":{"limit":20,"offset":0},"offnet":{"include_lcp":true,"exclude_offnet_content":true},"subtype_enabled":true,"use_content_site":true,"use_mags_nydc":true,"useNCP":true,"ads":{"ad_polices":true,"contentType":"video/mp4,application/x-shockwave-flash,application/vnd.apple.mpegurl","count":25,"frequency":3,"inline_video":true,"partial_viewability":true,"pu":"www.yahoo.com","se":5455272,"spaceid":1197793465,"start_index":1,"timeout":0,"type":"STRM,STRM_CONTENT,STRM_VIDEO","useHqImg":true,"useResizedImages":true},"batches":{"pagination":true,"size":20,"timeout":500,"total":170},"enableAuthorBio":true,"max_exclude":0,"min_count":3,"no_ss_pnr_ntk":true,"service":{"specRetry":{"enabled":true,"triggerDelayPct":50,"throttleRate":300}},"pageContext":{"site":"news","pageType":"minihome","renderTarget":"default"},"content_type":"politique","content_site":"news","ncpParams":{"body":{"gqlVariables":{"main":{"pagination":{"requestedCount":20,"contentOverrides":{"c0fcfaaf-6ade-36ea-9e55-d6d312f40890":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"03719994-4cfb-38de-86d4-40e3f9f0e944":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"efa7eeaa-f2bb-38e4-8872-aadc6956bea8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d9b2f785-6e0e-3f0e-b067-ff3a05430e1c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"e3330db0-2fcf-37bd-8a81-d5bbf9ecd50a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"89c88cbf-cf9b-395f-930f-46203cdb453e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"28d83ae2-da08-30ee-98a2-c677e79a8e8c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ce8f9199-76c8-3cf0-bdc8-a4173118a4fa":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9acf4279-8c17-3772-9cb1-c4e3f7b1b97d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ba32cbf2-fcd4-3942-b078-1c1afacbe1e0":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"6d4b991e-fa2b-3cd3-9646-a163e756ebad":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"186ca697-9685-3079-a850-6ac61be71429":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b799a1c7-7c8e-3ed0-b4c5-96f7a0fc793c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"535492ef-5cd5-3afb-8bee-f3ff8329bb22":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7611df6b-9455-310d-9304-d576cec10ab3":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b6cc309a-6d4e-3885-a556-33d5a2963c3e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"e72fc5e0-13bb-3a38-bb3e-e8bad090da1e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"5aa108d0-0350-349d-98bd-983324fa83c8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7aca2423-fdd4-332a-88ca-8f4e52d06070":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ee5a2b1b-e6d8-3c29-8483-bdadad83c04f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"811956d3-524f-3556-b437-6f7a23f50b54":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"975bd682-394b-36a9-ba10-548ee069eba5":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"51f3dff2-723f-3f0c-b200-0629b78d8556":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"77cefb5f-2d4e-3151-9f6c-3a08b6926d5c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"277ab7a8-9e4c-3897-9603-6650cd4ae0d8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b91bd98b-0883-347f-a3aa-012ef39583e6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"88110bf7-ebc9-3b07-846c-41a27ebe0d95":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d48d4a1c-d87f-3f24-92f5-4bada4dc55bf":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"58c66eca-b548-35df-b416-68fc0c84d73f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7977d89d-bda8-31c4-8df6-ec1639d8382b":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0a04c504-433f-31b1-8f8e-d15958d54421":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"53f2fcb2-29ab-3e6b-abcc-1486ced43dcb":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"f3499530-942a-3f24-a9cf-6f9745c8740d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b29a91d5-c3ee-3e2e-baac-203d58945ccc":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b2178de4-fb6d-33af-9668-88635b922266":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"dbe52798-eadd-3c7d-9006-1243e6b6a6dd":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"951b9b67-da2c-3f2d-b510-726ea25c6c97":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9126b5e5-24eb-33d7-b9df-139af5fbdcbe":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"68ff9822-2e4e-36c2-b043-5d98104f990a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"4ca74887-038e-3b0c-be2a-98b60875d687":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"1b6c0707-a864-318e-ac74-84df1b337cc7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"cd4d2662-d02c-3238-84d2-24fbed122da7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d557b41c-47b3-39c5-ab2b-8cc67a2972aa":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"8633dda3-68f7-3b8d-915b-178c62b7ad62":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"32066a8c-be84-379c-b449-fd931a0869f4":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"bab88417-f854-3c44-90d9-80bb0bb462f8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"594e58b0-6b76-3215-9796-c0a3042d5ed1":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"067c0638-d3f8-36cc-836b-1fee09b1c234":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"f114cb84-cff4-3d98-ad3b-543be8900ee7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"751f3396-afcc-316b-a8b5-83fd2c026565":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"064a01d4-17c0-3ce0-8e0b-e5a9c10861b2":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"44c8bf38-4612-36c3-917b-c30597f1415f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7e9a81df-b3ec-3648-ae8c-af4646352a58":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"1b738d60-358f-3982-bb67-b6008cde9a4a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"cd4d458b-0576-3ff6-aec6-90ed4ce157dd":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"819723b2-198f-3c05-9f20-e47fe03474a6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d7700073-335d-3dd5-8819-5f6958d0bf64":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"add0e458-3883-3316-8a41-3b21bec3c8be":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0572c93d-c507-3cca-96e4-822e1d31a93f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"46521dab-ee1e-30a9-abb0-df8f88eb60e3":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"87a52cdf-0146-3551-9075-9b302d9f64d0":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"84ed83be-a96e-34a7-a332-0d86bcea5191":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"94d5e171-c8e8-316a-bed3-aaaa5b74e621":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"5208bb9a-fb1f-3631-9823-1d3d53fbbd53":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ff5281cc-80e6-301a-a10a-fb07ff41b74b":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b90861d2-9f0d-3d40-a852-2441dd340c09":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"4d353c66-e28b-3998-b8bf-5fbd16e31155":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"a3b7e6b4-c627-3b64-87a6-301bd556b762":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"37971af3-e9ac-39d3-b049-cda092b7495c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ad4e3efc-6c21-33ba-b676-ba16f45a4098":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0017f6db-5f1c-3f6c-8d4a-f642ec09f214":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9d957f32-84c4-321b-a7e6-067519301e2a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"bb04afb8-1210-3f2e-bdc3-e2c56e717fb5":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"fa9322d7-c936-30ae-96f7-a675e7c5d7d6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"fdc0060e-a0e8-342f-ac28-5b2269ab7465":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"282aec95-c6cf-3411-b9d9-750ee284aec4":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"10e4afbe-9258-3306-a866-913beb80e38d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b52f9252-57b7-35a8-b4f7-b3208a7bf77f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7db9a4c7-d7a5-3cb0-ad64-b3e5cf750260":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"94cffedf-675b-3275-85b6-214502d463e8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"}},"remainingCount":80,"uuids":"58c66eca-b548-35df-b416-68fc0c84d73f:STORY,32066a8c-be84-379c-b449-fd931a0869f4:STORY,594e58b0-6b76-3215-9796-c0a3042d5ed1:STORY,282aec95-c6cf-3411-b9d9-750ee284aec4:STORY,0017f6db-5f1c-3f6c-8d4a-f642ec09f214:STORY,4ca74887-038e-3b0c-be2a-98b60875d687:STORY,03719994-4cfb-38de-86d4-40e3f9f0e944:STORY,ee5a2b1b-e6d8-3c29-8483-bdadad83c04f:STORY,b52f9252-57b7-35a8-b4f7-b3208a7bf77f:STORY,8633dda3-68f7-3b8d-915b-178c62b7ad62:STORY,9126b5e5-24eb-33d7-b9df-139af5fbdcbe:STORY,10e4afbe-9258-3306-a866-913beb80e38d:STORY,064a01d4-17c0-3ce0-8e0b-e5a9c10861b2:STORY,87a52cdf-0146-3551-9075-9b302d9f64d0:VIDEO,bab88417-f854-3c44-90d9-80bb0bb462f8:STORY,7e9a81df-b3ec-3648-ae8c-af4646352a58:STORY,94cffedf-675b-3275-85b6-214502d463e8:VIDEO,277ab7a8-9e4c-3897-9603-6650cd4ae0d8:STORY,51f3dff2-723f-3f0c-b200-0629b78d8556:STORY,68ff9822-2e4e-36c2-b043-5d98104f990a:STORY,b799a1c7-7c8e-3ed0-b4c5-96f7a0fc793c:STORY,add0e458-3883-3316-8a41-3b21bec3c8be:STORY,186ca697-9685-3079-a850-6ac61be71429:STORY,b6cc309a-6d4e-3885-a556-33d5a2963c3e:STORY,6d4b991e-fa2b-3cd3-9646-a163e756ebad:STORY,d9b2f785-6e0e-3f0e-b067-ff3a05430e1c:STORY,b91bd98b-0883-347f-a3aa-012ef39583e6:STORY,cd4d2662-d02c-3238-84d2-24fbed122da7:STORY,fdc0060e-a0e8-342f-ac28-5b2269ab7465:STORY,dbe52798-eadd-3c7d-9006-1243e6b6a6dd:STORY,7977d89d-bda8-31c4-8df6-ec1639d8382b:STORY,067c0638-d3f8-36cc-836b-1fee09b1c234:STORY,811956d3-524f-3556-b437-6f7a23f50b54:STORY,9acf4279-8c17-3772-9cb1-c4e3f7b1b97d:STORY,c0fcfaaf-6ade-36ea-9e55-d6d312f40890:STORY,b90861d2-9f0d-3d40-a852-2441dd340c09:STORY,1b738d60-358f-3982-bb67-b6008cde9a4a:STORY,d48d4a1c-d87f-3f24-92f5-4bada4dc55bf:STORY,ba32cbf2-fcd4-3942-b078-1c1afacbe1e0:VIDEO,77cefb5f-2d4e-3151-9f6c-3a08b6926d5c:STORY,7aca2423-fdd4-332a-88ca-8f4e52d06070:VIDEO,d557b41c-47b3-39c5-ab2b-8cc67a2972aa:STORY,28d83ae2-da08-30ee-98a2-c677e79a8e8c:STORY,84ed83be-a96e-34a7-a332-0d86bcea5191:STORY,819723b2-198f-3c05-9f20-e47fe03474a6:VIDEO,4d353c66-e28b-3998-b8bf-5fbd16e31155:STORY,e3330db0-2fcf-37bd-8a81-d5bbf9ecd50a:VIDEO,ce8f9199-76c8-3cf0-bdc8-a4173118a4fa:STORY,f114cb84-cff4-3d98-ad3b-543be8900ee7:STORY,53f2fcb2-29ab-3e6b-abcc-1486ced43dcb:STORY,efa7eeaa-f2bb-38e4-8872-aadc6956bea8:STORY,975bd682-394b-36a9-ba10-548ee069eba5:STORY,0572c93d-c507-3cca-96e4-822e1d31a93f:STORY,d7700073-335d-3dd5-8819-5f6958d0bf64:STORY,9d957f32-84c4-321b-a7e6-067519301e2a:VIDEO,0a04c504-433f-31b1-8f8e-d15958d54421:STORY,b29a91d5-c3ee-3e2e-baac-203d58945ccc:STORY,cd4d458b-0576-3ff6-aec6-90ed4ce157dd:STORY,751f3396-afcc-316b-a8b5-83fd2c026565:STORY,fa9322d7-c936-30ae-96f7-a675e7c5d7d6:STORY,bb04afb8-1210-3f2e-bdc3-e2c56e717fb5:STORY,1b6c0707-a864-318e-ac74-84df1b337cc7:STORY,535492ef-5cd5-3afb-8bee-f3ff8329bb22:STORY,e72fc5e0-13bb-3a38-bb3e-e8bad090da1e:STORY,7611df6b-9455-310d-9304-d576cec10ab3:STORY,ff5281cc-80e6-301a-a10a-fb07ff41b74b:STORY,88110bf7-ebc9-3b07-846c-41a27ebe0d95:STORY,46521dab-ee1e-30a9-abb0-df8f88eb60e3:STORY,5aa108d0-0350-349d-98bd-983324fa83c8:STORY,b2178de4-fb6d-33af-9668-88635b922266:VIDEO,5208bb9a-fb1f-3631-9823-1d3d53fbbd53:STORY,37971af3-e9ac-39d3-b049-cda092b7495c:VIDEO,94d5e171-c8e8-316a-bed3-aaaa5b74e621:STORY,a3b7e6b4-c627-3b64-87a6-301bd556b762:STORY,7db9a4c7-d7a5-3cb0-ad64-b3e5cf750260:STORY,f3499530-942a-3f24-a9cf-6f9745c8740d:STORY,ad4e3efc-6c21-33ba-b676-ba16f45a4098:STORY,951b9b67-da2c-3f2d-b510-726ea25c6c97:STORY,44c8bf38-4612-36c3-917b-c30597f1415f:STORY,89c88cbf-cf9b-395f-930f-46203cdb453e:STORY"}}}}}}}},"context":{"feature":"cacheContentCanvas,enableCCPAFooter,enableGDPRFooter,enableCMP,enableConsentData,livecoverage,newContentAttribution,newLogo,rivendellMigration,videoDocking,userintent,enableReconsent,newsVideo,ncpStream,newLayout,deferModalCluster,clusterBackfill,hideLREC2Singleton,sponsoredAds","bkt":"news-FR-fr-FR-def","crumb":"6a5SY1XJFm0","device":"desktop","intl":"fr","lang":"fr-FR","partner":"none","prid":"77t6k31fbqkjt","region":"FR","site":"news","tz":"Asia/Shanghai","ver":"0.0.12105301","ecma":"modern"}}' \--compressed

然后https://curl.trillworks.com/这网站登场了:可以直接将curl的请求转换成各种语言对应的代码。python可以选择转成requests库对应的代码。

转换完成,不用自己调试参数了,直接一把梭,方便了很多。postman的import功能也可以实现这样的效果,但实测这个请求postman转过来不对。

import requestsheaders = {'authority': 'fr.news.yahoo.com','user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36','x-requested-with': 'XMLHttpRequest','content-type': 'application/json','accept': '*/*','origin': 'https://fr.news.yahoo.com','sec-fetch-site': 'same-origin','sec-fetch-mode': 'cors','sec-fetch-dest': 'empty','referer': 'https://fr.news.yahoo.com/politique/','accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6','cookie': 'B=et65l8pfbq5gs&b=3&s=qj; APID=UP604a2bca-95c9-11ea-a924-06d17d12d6d8; EuConsent=BOzYt24OzYt25AOABCFRC7uAAAAtl6__f_97_8_v2ddvduz_Ov_j_c__3XW8fPZvcELzhK9Meu_2xzd4u9wNRM5wckx87eJrEso5czISsG-RMod_zt__3ziX9oxPowEc9rz3nbEw6vs2v-ZzBCGJ_Iw; A1=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0; A3=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0; GUC=AQABAQFevl1e-kIfkASh; A1S=d=AQABBB0WvV4CEPSOSVBE86u8N4i4608w8xYFEgABAQFdvl76Xliia3sB_iMAAAcIHBa9Xka1mO4&S=AQAAAg6LgQ3oxYKV9UFSU7n_Ih0&j=WORLD; APIDTS=1589454807; EuConsent=BOzYt24OzZTj9AOABCFRC7uAAAAtl6__f_97_8_v2ddvduz_Ov_j_c__3XW8fPZvcELzhK9Meu_2xzd4u9wNRM5wckx87eJrEso5czISsG-RMod_zt__3ziX9oxPowEc9rz3nbEw6vs2v-ZzBCGJ_Iw; cmp=v=28&t=1589465728&j=1&o=106',
}params = (('bkt', 'news-FR-fr-FR-def'),('crumb', '6a5SY1XJFm0'),('device', 'desktop'),('ecma', 'modern'),('feature', 'cacheContentCanvas,enableCCPAFooter,enableGDPRFooter,enableCMP,enableConsentData,livecoverage,newContentAttribution,newLogo,rivendellMigration,videoDocking,userintent,enableReconsent,newsVideo,ncpStream,newLayout,deferModalCluster,clusterBackfill,hideLREC2Singleton,sponsoredAds'),('intl', 'fr'),('lang', 'fr-FR'),('partner', 'none'),('prid', '77t6k31fbqkjt'),('region', 'FR'),('site', 'news'),('tz', 'Asia/Shanghai'),('ver', '0.0.12105301'),
)data = '{"requests":{"g0":{"resource":"StreamService","operation":"read","params":{"ui":{"comments":true,"comments_offnet":true,"dispatch_content_store":true,"editorial_featured_count":1,"image_quality_override":true,"link_out_allowed":true,"needtoknow_template":"filmstrip","ntk_bypassA3c":true,"pubtime_maxage":-1,"relative_links":true,"show_comment_count":true,"smart_crop":true,"storyline_count":2,"storyline_enabled":true,"storyline_min":2,"summary":true,"thumbnail_size":100,"tiles":{"allowPartialRows":true,"doubleTallStart":0,"featured_label":false,"gradient":false,"height":175,"resizeImages":false,"textOnly":[{"backgroundColor":"#fff","foregroundColor":"#000"}],"width_max":300,"width_min":200},"view":"mega","editorial_content_count":6,"editorial_content_min":0,"enable_lead_fallback_image":true,"lead_fallback_image":"https://s.yimg.com/dh/ap/my/themes/dark_1366x854_01_prog.jpg","roundup":true},"category":"LISTID:5763faba-6a6b-45aa-bd37-37ca830f7660","forceJpg":true,"releasesParams":{"limit":20,"offset":0},"offnet":{"include_lcp":true,"exclude_offnet_content":true},"subtype_enabled":true,"use_content_site":true,"use_mags_nydc":true,"useNCP":true,"ads":{"ad_polices":true,"contentType":"video/mp4,application/x-shockwave-flash,application/vnd.apple.mpegurl","count":25,"frequency":3,"inline_video":true,"partial_viewability":true,"pu":"www.yahoo.com","se":5455272,"spaceid":1197793465,"start_index":1,"timeout":0,"type":"STRM,STRM_CONTENT,STRM_VIDEO","useHqImg":true,"useResizedImages":true},"batches":{"pagination":true,"size":20,"timeout":500,"total":170},"enableAuthorBio":true,"max_exclude":0,"min_count":3,"no_ss_pnr_ntk":true,"service":{"specRetry":{"enabled":true,"triggerDelayPct":50,"throttleRate":300}},"pageContext":{"site":"news","pageType":"minihome","renderTarget":"default"},"content_type":"politique","content_site":"news","ncpParams":{"body":{"gqlVariables":{"main":{"pagination":{"requestedCount":20,"contentOverrides":{"c0fcfaaf-6ade-36ea-9e55-d6d312f40890":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"03719994-4cfb-38de-86d4-40e3f9f0e944":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"efa7eeaa-f2bb-38e4-8872-aadc6956bea8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d9b2f785-6e0e-3f0e-b067-ff3a05430e1c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"e3330db0-2fcf-37bd-8a81-d5bbf9ecd50a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"89c88cbf-cf9b-395f-930f-46203cdb453e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"28d83ae2-da08-30ee-98a2-c677e79a8e8c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ce8f9199-76c8-3cf0-bdc8-a4173118a4fa":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9acf4279-8c17-3772-9cb1-c4e3f7b1b97d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ba32cbf2-fcd4-3942-b078-1c1afacbe1e0":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"6d4b991e-fa2b-3cd3-9646-a163e756ebad":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"186ca697-9685-3079-a850-6ac61be71429":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b799a1c7-7c8e-3ed0-b4c5-96f7a0fc793c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"535492ef-5cd5-3afb-8bee-f3ff8329bb22":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7611df6b-9455-310d-9304-d576cec10ab3":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b6cc309a-6d4e-3885-a556-33d5a2963c3e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"e72fc5e0-13bb-3a38-bb3e-e8bad090da1e":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"5aa108d0-0350-349d-98bd-983324fa83c8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7aca2423-fdd4-332a-88ca-8f4e52d06070":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ee5a2b1b-e6d8-3c29-8483-bdadad83c04f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"811956d3-524f-3556-b437-6f7a23f50b54":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"975bd682-394b-36a9-ba10-548ee069eba5":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"51f3dff2-723f-3f0c-b200-0629b78d8556":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"77cefb5f-2d4e-3151-9f6c-3a08b6926d5c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"277ab7a8-9e4c-3897-9603-6650cd4ae0d8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b91bd98b-0883-347f-a3aa-012ef39583e6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"88110bf7-ebc9-3b07-846c-41a27ebe0d95":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d48d4a1c-d87f-3f24-92f5-4bada4dc55bf":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"58c66eca-b548-35df-b416-68fc0c84d73f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7977d89d-bda8-31c4-8df6-ec1639d8382b":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0a04c504-433f-31b1-8f8e-d15958d54421":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"53f2fcb2-29ab-3e6b-abcc-1486ced43dcb":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"f3499530-942a-3f24-a9cf-6f9745c8740d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b29a91d5-c3ee-3e2e-baac-203d58945ccc":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b2178de4-fb6d-33af-9668-88635b922266":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"dbe52798-eadd-3c7d-9006-1243e6b6a6dd":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"951b9b67-da2c-3f2d-b510-726ea25c6c97":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9126b5e5-24eb-33d7-b9df-139af5fbdcbe":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"68ff9822-2e4e-36c2-b043-5d98104f990a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"4ca74887-038e-3b0c-be2a-98b60875d687":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"1b6c0707-a864-318e-ac74-84df1b337cc7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"cd4d2662-d02c-3238-84d2-24fbed122da7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d557b41c-47b3-39c5-ab2b-8cc67a2972aa":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"8633dda3-68f7-3b8d-915b-178c62b7ad62":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"32066a8c-be84-379c-b449-fd931a0869f4":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"bab88417-f854-3c44-90d9-80bb0bb462f8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"594e58b0-6b76-3215-9796-c0a3042d5ed1":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"067c0638-d3f8-36cc-836b-1fee09b1c234":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"f114cb84-cff4-3d98-ad3b-543be8900ee7":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"751f3396-afcc-316b-a8b5-83fd2c026565":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"064a01d4-17c0-3ce0-8e0b-e5a9c10861b2":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"44c8bf38-4612-36c3-917b-c30597f1415f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7e9a81df-b3ec-3648-ae8c-af4646352a58":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"1b738d60-358f-3982-bb67-b6008cde9a4a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"cd4d458b-0576-3ff6-aec6-90ed4ce157dd":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"819723b2-198f-3c05-9f20-e47fe03474a6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"d7700073-335d-3dd5-8819-5f6958d0bf64":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"add0e458-3883-3316-8a41-3b21bec3c8be":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0572c93d-c507-3cca-96e4-822e1d31a93f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"46521dab-ee1e-30a9-abb0-df8f88eb60e3":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"87a52cdf-0146-3551-9075-9b302d9f64d0":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"84ed83be-a96e-34a7-a332-0d86bcea5191":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"94d5e171-c8e8-316a-bed3-aaaa5b74e621":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"5208bb9a-fb1f-3631-9823-1d3d53fbbd53":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ff5281cc-80e6-301a-a10a-fb07ff41b74b":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b90861d2-9f0d-3d40-a852-2441dd340c09":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"4d353c66-e28b-3998-b8bf-5fbd16e31155":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"a3b7e6b4-c627-3b64-87a6-301bd556b762":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"37971af3-e9ac-39d3-b049-cda092b7495c":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"ad4e3efc-6c21-33ba-b676-ba16f45a4098":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"0017f6db-5f1c-3f6c-8d4a-f642ec09f214":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"9d957f32-84c4-321b-a7e6-067519301e2a":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"bb04afb8-1210-3f2e-bdc3-e2c56e717fb5":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"fa9322d7-c936-30ae-96f7-a675e7c5d7d6":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"fdc0060e-a0e8-342f-ac28-5b2269ab7465":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"282aec95-c6cf-3411-b9d9-750ee284aec4":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"10e4afbe-9258-3306-a866-913beb80e38d":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"b52f9252-57b7-35a8-b4f7-b3208a7bf77f":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"7db9a4c7-d7a5-3cb0-ad64-b3e5cf750260":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"},"94cffedf-675b-3275-85b6-214502d463e8":{"list":"5763faba-6a6b-45aa-bd37-37ca830f7660"}},"remainingCount":80,"uuids":"58c66eca-b548-35df-b416-68fc0c84d73f:STORY,32066a8c-be84-379c-b449-fd931a0869f4:STORY,594e58b0-6b76-3215-9796-c0a3042d5ed1:STORY,282aec95-c6cf-3411-b9d9-750ee284aec4:STORY,0017f6db-5f1c-3f6c-8d4a-f642ec09f214:STORY,4ca74887-038e-3b0c-be2a-98b60875d687:STORY,03719994-4cfb-38de-86d4-40e3f9f0e944:STORY,ee5a2b1b-e6d8-3c29-8483-bdadad83c04f:STORY,b52f9252-57b7-35a8-b4f7-b3208a7bf77f:STORY,8633dda3-68f7-3b8d-915b-178c62b7ad62:STORY,9126b5e5-24eb-33d7-b9df-139af5fbdcbe:STORY,10e4afbe-9258-3306-a866-913beb80e38d:STORY,064a01d4-17c0-3ce0-8e0b-e5a9c10861b2:STORY,87a52cdf-0146-3551-9075-9b302d9f64d0:VIDEO,bab88417-f854-3c44-90d9-80bb0bb462f8:STORY,7e9a81df-b3ec-3648-ae8c-af4646352a58:STORY,94cffedf-675b-3275-85b6-214502d463e8:VIDEO,277ab7a8-9e4c-3897-9603-6650cd4ae0d8:STORY,51f3dff2-723f-3f0c-b200-0629b78d8556:STORY,68ff9822-2e4e-36c2-b043-5d98104f990a:STORY,b799a1c7-7c8e-3ed0-b4c5-96f7a0fc793c:STORY,add0e458-3883-3316-8a41-3b21bec3c8be:STORY,186ca697-9685-3079-a850-6ac61be71429:STORY,b6cc309a-6d4e-3885-a556-33d5a2963c3e:STORY,6d4b991e-fa2b-3cd3-9646-a163e756ebad:STORY,d9b2f785-6e0e-3f0e-b067-ff3a05430e1c:STORY,b91bd98b-0883-347f-a3aa-012ef39583e6:STORY,cd4d2662-d02c-3238-84d2-24fbed122da7:STORY,fdc0060e-a0e8-342f-ac28-5b2269ab7465:STORY,dbe52798-eadd-3c7d-9006-1243e6b6a6dd:STORY,7977d89d-bda8-31c4-8df6-ec1639d8382b:STORY,067c0638-d3f8-36cc-836b-1fee09b1c234:STORY,811956d3-524f-3556-b437-6f7a23f50b54:STORY,9acf4279-8c17-3772-9cb1-c4e3f7b1b97d:STORY,c0fcfaaf-6ade-36ea-9e55-d6d312f40890:STORY,b90861d2-9f0d-3d40-a852-2441dd340c09:STORY,1b738d60-358f-3982-bb67-b6008cde9a4a:STORY,d48d4a1c-d87f-3f24-92f5-4bada4dc55bf:STORY,ba32cbf2-fcd4-3942-b078-1c1afacbe1e0:VIDEO,77cefb5f-2d4e-3151-9f6c-3a08b6926d5c:STORY,7aca2423-fdd4-332a-88ca-8f4e52d06070:VIDEO,d557b41c-47b3-39c5-ab2b-8cc67a2972aa:STORY,28d83ae2-da08-30ee-98a2-c677e79a8e8c:STORY,84ed83be-a96e-34a7-a332-0d86bcea5191:STORY,819723b2-198f-3c05-9f20-e47fe03474a6:VIDEO,4d353c66-e28b-3998-b8bf-5fbd16e31155:STORY,e3330db0-2fcf-37bd-8a81-d5bbf9ecd50a:VIDEO,ce8f9199-76c8-3cf0-bdc8-a4173118a4fa:STORY,f114cb84-cff4-3d98-ad3b-543be8900ee7:STORY,53f2fcb2-29ab-3e6b-abcc-1486ced43dcb:STORY,efa7eeaa-f2bb-38e4-8872-aadc6956bea8:STORY,975bd682-394b-36a9-ba10-548ee069eba5:STORY,0572c93d-c507-3cca-96e4-822e1d31a93f:STORY,d7700073-335d-3dd5-8819-5f6958d0bf64:STORY,9d957f32-84c4-321b-a7e6-067519301e2a:VIDEO,0a04c504-433f-31b1-8f8e-d15958d54421:STORY,b29a91d5-c3ee-3e2e-baac-203d58945ccc:STORY,cd4d458b-0576-3ff6-aec6-90ed4ce157dd:STORY,751f3396-afcc-316b-a8b5-83fd2c026565:STORY,fa9322d7-c936-30ae-96f7-a675e7c5d7d6:STORY,bb04afb8-1210-3f2e-bdc3-e2c56e717fb5:STORY,1b6c0707-a864-318e-ac74-84df1b337cc7:STORY,535492ef-5cd5-3afb-8bee-f3ff8329bb22:STORY,e72fc5e0-13bb-3a38-bb3e-e8bad090da1e:STORY,7611df6b-9455-310d-9304-d576cec10ab3:STORY,ff5281cc-80e6-301a-a10a-fb07ff41b74b:STORY,88110bf7-ebc9-3b07-846c-41a27ebe0d95:STORY,46521dab-ee1e-30a9-abb0-df8f88eb60e3:STORY,5aa108d0-0350-349d-98bd-983324fa83c8:STORY,b2178de4-fb6d-33af-9668-88635b922266:VIDEO,5208bb9a-fb1f-3631-9823-1d3d53fbbd53:STORY,37971af3-e9ac-39d3-b049-cda092b7495c:VIDEO,94d5e171-c8e8-316a-bed3-aaaa5b74e621:STORY,a3b7e6b4-c627-3b64-87a6-301bd556b762:STORY,7db9a4c7-d7a5-3cb0-ad64-b3e5cf750260:STORY,f3499530-942a-3f24-a9cf-6f9745c8740d:STORY,ad4e3efc-6c21-33ba-b676-ba16f45a4098:STORY,951b9b67-da2c-3f2d-b510-726ea25c6c97:STORY,44c8bf38-4612-36c3-917b-c30597f1415f:STORY,89c88cbf-cf9b-395f-930f-46203cdb453e:STORY"}}}}}}}},"context":{"feature":"cacheContentCanvas,enableCCPAFooter,enableGDPRFooter,enableCMP,enableConsentData,livecoverage,newContentAttribution,newLogo,rivendellMigration,videoDocking,userintent,enableReconsent,newsVideo,ncpStream,newLayout,deferModalCluster,clusterBackfill,hideLREC2Singleton,sponsoredAds","bkt":"news-FR-fr-FR-def","crumb":"6a5SY1XJFm0","device":"desktop","intl":"fr","lang":"fr-FR","partner":"none","prid":"77t6k31fbqkjt","region":"FR","site":"news","tz":"Asia/Shanghai","ver":"0.0.12105301","ecma":"modern"}}'response = requests.post('https://fr.news.yahoo.com/_td/api/resource', headers=headers, params=params, data=data)#NB. Original query string below. It seems impossible to parse and
#reproduce query strings 100% accurately so the one below is given
#in case the reproduced version is not "correct".
# response = requests.post('https://fr.news.yahoo.com/_td/api/resource?bkt=news-FR-fr-FR-def&crumb=6a5SY1XJFm0&device=desktop&ecma=modern&feature=cacheContentCanvas%2CenableCCPAFooter%2CenableGDPRFooter%2CenableCMP%2CenableConsentData%2Clivecoverage%2CnewContentAttribution%2CnewLogo%2CrivendellMigration%2CvideoDocking%2Cuserintent%2CenableReconsent%2CnewsVideo%2CncpStream%2CnewLayout%2CdeferModalCluster%2CclusterBackfill%2ChideLREC2Singleton%2CsponsoredAds&intl=fr&lang=fr-FR&partner=none&prid=77t6k31fbqkjt&region=FR&site=news&tz=Asia%2FShanghai&ver=0.0.12105301', headers=headers, data=data)

 

这篇关于复制chrome请求头以及Copy as cURL直接转成python代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1049213

相关文章

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss

【学习笔记】 陈强-机器学习-Python-Ch15 人工神经网络(1)sklearn

系列文章目录 监督学习:参数方法 【学习笔记】 陈强-机器学习-Python-Ch4 线性回归 【学习笔记】 陈强-机器学习-Python-Ch5 逻辑回归 【课后题练习】 陈强-机器学习-Python-Ch5 逻辑回归(SAheart.csv) 【学习笔记】 陈强-机器学习-Python-Ch6 多项逻辑回归 【学习笔记 及 课后题练习】 陈强-机器学习-Python-Ch7 判别分析 【学

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

nudepy,一个有趣的 Python 库!

更多资料获取 📚 个人网站:ipengtao.com 大家好,今天为大家分享一个有趣的 Python 库 - nudepy。 Github地址:https://github.com/hhatto/nude.py 在图像处理和计算机视觉应用中,检测图像中的不适当内容(例如裸露图像)是一个重要的任务。nudepy 是一个基于 Python 的库,专门用于检测图像中的不适当内容。该

代码随想录冲冲冲 Day39 动态规划Part7

198. 打家劫舍 dp数组的意义是在第i位的时候偷的最大钱数是多少 如果nums的size为0 总价值当然就是0 如果nums的size为1 总价值是nums[0] 遍历顺序就是从小到大遍历 之后是递推公式 对于dp[i]的最大价值来说有两种可能 1.偷第i个 那么最大价值就是dp[i-2]+nums[i] 2.不偷第i个 那么价值就是dp[i-1] 之后取这两个的最大值就是d

pip-tools:打造可重复、可控的 Python 开发环境,解决依赖关系,让代码更稳定

在 Python 开发中,管理依赖关系是一项繁琐且容易出错的任务。手动更新依赖版本、处理冲突、确保一致性等等,都可能让开发者感到头疼。而 pip-tools 为开发者提供了一套稳定可靠的解决方案。 什么是 pip-tools? pip-tools 是一组命令行工具,旨在简化 Python 依赖关系的管理,确保项目环境的稳定性和可重复性。它主要包含两个核心工具:pip-compile 和 pip