Downloading file using IE from python

后端 未结 8 1026
无人及你
无人及你 2021-02-04 15:38

I\'m trying to download file with Python using IE:

from win32com.client import DispatchWithEvents

class EventHandler(object):
    def OnDownloadBegin(self):
            


        
8条回答
  •  遇见更好的自我
    2021-02-04 16:04

    I don't know how to say this nicely, but this sounds like about the most foolhardy software idea in recent memory. Python is much more capable of performing AJAX calls than IE is.

    To access the data, yes, you can use urllib and urllib2 . If there is JSON data in the response, there's the json library; likewise for XML and HTML, there's BeautifulSoup.

    For one project, I had to write a Python program that would simulate a browser and sign into any of 20 different social networks (remember Friendster? Orkut? CyberWorld? I do), and upload images and text into the user's account, even grasping CAPTCHAs and complex JavaScript interactions. Pure Python makes it (comparatively) easy; as you've already seen, trying to use IE makes it impossible.

提交回复
热议问题