1

对于这个例子,我知道使用 requests 或类似的 python 模块更容易。
但我需要用 ghost.py 模块来做

此代码示例不起作用:

from ghost import Ghost

ghost = Ghost()

with ghost.start() as session:
    page, extra_resources = session.open('http://www.7-zip.org/a/7z1506-x64.exe')

    with open('7z1506-x64.exe', 'wb') as file:
        file.write(session.http_resources)
4

2 回答 2

0

我在这里创建了一些片段: https ://github.com/jeanphix/Ghost.py/issues/273

但这不是最终的解决方案。

于 2015-10-16T08:29:52.627 回答
0

对于 Ghost.py (0.2.3)

    ...
    with open('7z1506-x64.exe', 'wb') as file:
        file.write(eval(extra_resources[0].content))
于 2017-02-18T15:18:05.360 回答