Python命令行标题作为字典参数传递,给出错误

时间:2019-01-23 16:19:35

标签: python header

给出的python命令行语句是

“ python C:\ APIIngest.py” https://cloud.com/biodieselreports“” C:\ WRA.txt“” {'dateTimeModified':'2018-05-31T00:00:00'}“” {'api- key':'1nDNRPQVGI6jYSVntk'}“” C:\ cacert.pem“” httpBasicAuth“” iUser“” 82 $ J *“ 30”

APIingest.py具有以下代码:

def call_api():

    auth = None
    if auth_type:
        if auth_type.lower() == 'httpbasicauth':
            auth = HTTPBasicAuth(user, password)

    response = requests.get(
        url=url,
        outfile = outFile,
        params=parameters,
        headers=headers,
        verify=ssl_cert_path,
        auth=auth,
        timeout=timeout
    ).content

    print('Writing api response to ' + output_file_full_path)

    with open(output_file_full_path, 'w') as output_file:
        output_file.write(response)

    print('end')


call_api()

我收到标题项错误,str对象没有属性。 我是否以正确的方式传递它?请指教。

0 个答案:

没有答案