[Tutor] Using Python to access .txt files stored behind a firewall as .exe files
ian.monat at gmail.com
Tue May 2 14:06:40 EDT 2017
Thanks for your commentary, made me laugh, I wish switching distributors
were that easy.
I could give them reasons why .exe files won't work for me but they don't
really care if I take the data files on their site or not. So I guess to
answer your question, we need them more.
That said, I think my plan is to use requests to pull the .exe file down
and and then try to write a python script to extract the .zip without
running the .exe. (maybe with pandas?) I'm a beginner with python so we'll
see how it goes!
Thanks for your help -Ian
On Tue, May 2, 2017 at 9:44 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, May 01, 2017 at 10:20:42AM -0700, Ian Monat wrote:
> > Then you have you run the .exe which produces a zipped file, and inside
> > zipped file, is the .txt, which what I really want. There's no way the
> > distributor will change anything about how they store files on their
> > website for me. I've written a script using the requests module but I
> > think a web scraper like Scrapy, Beautiful Soup or Selinium may be
> > required.
> > What would you do?
> Find another distributor.
> (Its this sort of business to business incompetence that makes me laugh
> when people say that private industry is always more efficient than the
> alternatives. Did I say laugh? I meant cry.)
> Seriously, can't you tell them that your anti-virus blocks the .exe
> files, and if they want you to use their system, they'll have to provide
> text files as text files?
> Or tell them that you're using Apple Macs and the .exe files don't run
> under Mac.
> I guess it depends on whether you need them more than they need you.
> In any case, this isn't a problem that can be solved by a web scraper.
> The distributor's website provides .exe files. There's nothing you can
> do about that except complain or leave. The website gives you a .exe
> file, so that's what you receive.
> However, once you have the .exe file in your possession, you *may* be
> able to hack open the file and extract the .zip file without running it.
> That will require detailed knowledge of how the .exe file does its job,
> but it is conceivable that it will work. A good low-level hacker could
> probably determine whether the zip file is embedded in the .exe or if it
> is generated on the fly. That's beyond my skills though.
> If it is generated on the fly, you're screwed. You have no choice but to
> run the .exe, until you do the zip doesn't even exist. But if it is
> embedded, it can be extracted, and once the zip file is extracted,
> Python can easily unzip it.
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor