requests-html icon indicating copy to clipboard operation
requests-html copied to clipboard

Embedded Scripts

Open Nickleaton opened this issue 6 years ago • 0 comments

I'm trying to automatically download a file from this URL.

https://www.gleif.org/en/lei-data/lei-mapping/download-isin-to-lei-relationship-files

There are two problems.

1 The website pushes the file with the timestamp it was created embedded in the filename 2. The file names are from a script.

from requests_html import HTMLSession
session = HTMLSession(mock_browser=True)
r = session.get(url)
r.html.render()

So I was tring to get the request, render it, then see what the link is that I need to download.

It fails as follows

  File "C:\Users\xxxx\PycharmProjects\Gleif\venv\lib\site-packages\pyppeteer\chromium_downloader.py", line 124, in extract_zip
    with ZipFile(data) as zf:
  File "C:\Users\xxxx\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1222, in __init__
    self._RealGetContents()
  File "C:\Users\xxxx\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1289, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

Any ideas?

Thanks.

Nickleaton avatar Jul 17 '19 15:07 Nickleaton