jdvala / python-lei

This project is wraper for Leilex, legal entity identifier API. Includes ISIN-LEI conversion. Search LEI number using company name.
MIT License
19 stars 6 forks source link

File is not zip and index out of range #10

Closed pinpss closed 1 month ago

pinpss commented 2 years ago

Hello, This package looks really promising. I was trying to run the example codes and got the following errors (I tried running it on my computer and thru google colab without luck)

from python_lei.utils import Download
Download()

ERROR:python_lei.utils:No response from GLEIF server.
---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
[<ipython-input-2-2647fe19722e>](https://cydm97mcqmq-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221017-060050-RC00_481597456#) in <module>
      1 from python_lei.utils import Download
----> 2 Download()
      3 

3 frames
[/usr/lib/python3.7/zipfile.py](https://cydm97mcqmq-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221017-060050-RC00_481597456#) in _RealGetContents(self)
   1323             raise BadZipFile("File is not a zip file")
   1324         if not endrec:
-> 1325             raise BadZipFile("File is not a zip file")
   1326         if self.debug > 1:
   1327             print(endrec)

BadZipFile: File is not a zip file

and for the lei_isin conversion:

from python_lei.isin_lei import LEItoISIN
lei_to_isin = LEItoISIN()

IndexError                                Traceback (most recent call last)
[<ipython-input-3-7903da1e8e7c>](https://cydm97mcqmq-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221017-060050-RC00_481597456#) in <module>
      1 from python_lei.isin_lei import LEItoISIN
----> 2 lei_to_isin = LEItoISIN()

1 frames
[/usr/local/lib/python3.7/dist-packages/python_lei/utils.py](https://cydm97mcqmq-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221017-060050-RC00_481597456#) in load_data()
     96     Loads and Returns the dataframe
     97     """
---> 98     dataframe = pd.read_csv(os.path.join(RESOURCE_DIR, os.listdir(RESOURCE_DIR)[0]))
     99     return dataframe

IndexError: list index out of range
jdvala commented 2 years ago

Hi @pinpss, thank you for your kind words. I am not aware about this problem. I will take a look at the problem this weekend. Thank you for reporting.

Kamparia commented 1 year ago

Hi @jdvala, any update on this issue? I am getting the same error message.

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

jdvala commented 1 month ago

The website has changed how the files are downloaded.

jdvala commented 1 month ago

Issue should be fixed in #12 please download the updated version of python-lei (0.1.2)