2015-09-02 62 views
1

對於這個例子,我知道使用請求或類似的python模塊更容易。
但我需要與ghost.py模塊做如何使用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) 
+0

無人?可能嗎?我在模塊中找不到任何下載方法。 – baltazer

回答

0

對於Ghost.py(0.2.3)

... 
    with open('7z1506-x64.exe', 'wb') as file: 
     file.write(eval(extra_resources[0].content)) 
相關問題