Python 3000 の標準ライブラリに入るかもしれない [*] Httplib2 を使ってみました。 Digest 認証も 自局認証の SSL も突破できる。(何事もなくw) curl 叩くより使いやすいかも。
>>> import httplib2
>>> h = httplib2.Http()
>>> esp, content = h.request("https://localhost:8080/projects/myproject/report/1?format=csv")
>>> esp
{'connection': 'close',
'content-length': '483',
'content-type': 'text/html; charset=iso-8859-1',
'date': 'Tue, 29 May 2007 12:41:35 GMT',
'server': 'Apache/2.0.52 (CentOS)',
'status': '401',
'www-authenticate': 'Digest realm="localhost", nonce="pda9AZ0xBAA=084f285bb297831c7cc2db78bfbba6f09941ff12", algorithm=MD5, domain="/projects/myproject/", qop="auth"'}
>>> h.add_credentials("username", "password")
>>> esp, content = h.request("https://localhost:8080/projects/myproject/report/1?format=csv")
>>> esp
{'authentication-info': 'rspauth="80ef386a7cffe4602de5196f06ed1682", cnonce="b7047e2fb250f50f", nc=00000002, qop=auth',
'connection': 'close',
'content-disposition': 'filename=report_1.csv',
'content-location': 'https://localhost:8080/projects/myproject/report/1?format=csv',
'content-type': 'text/csv;charset=utf-8',
'date': 'Tue, 29 May 2007 12:41:40 GMT',
'server': 'Apache/2.0.52 (CentOS)',
'set-cookie': 'trac_form_token=f9cf013a881317cdf5b0f139; Path=/projects/myproject;',
'status': '200',
'transfer-encoding': 'chunked'}
| [*] | Project Goal: To become a worthy addition to the Python core library. |
