将curl命令转换为请求

时间:2015-08-21 02:35:24

标签: python curl python-requests

如何转换以下curl命令:

curl -L -k -H "X-Apple-Store-Front: 143441" -H "X-Apple-Tz: 3600"
     -A "iTunes/9.2.1 (Macintosh; Intel Mac OS X 10.5.8) AppleWebKit/533.16"
     "https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?cc=us&fcId=363484947"

进入相应的requests来电?

1 个答案:

答案 0 :(得分:0)

您可以这样做:

import requests

url = 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?cc=us&fcId=363484947'
headers = {
    'X-Apple-Store-Front': '143441-1,12',
    'X-Apple-Tz': '3600',
}

requests.get(url, headers=headers)