NDAR / nda-tools

Python package for interacting with NDA web services. Used to validate, submit, and download data to and from NDA.
MIT License
48 stars 22 forks source link

UTF encoding error in api_request #40

Closed clin045 closed 2 years ago

clin045 commented 2 years ago

I have been getting the follow error when trying to validate a manifest file submission:

UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in position 0: Body ('\ufeff') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.

This can be fixed by adding a call to the .encode() method below line 79 in Utils.py:

79     try:
80         if data is not None:
81             data = data.encode('utf-8')
82         r = session.send(requests.Request(verb, endpoint, headers,           auth=auth, data=data).prepare(),
83                          timeout=300, stream=False)

Happy to put in a PR if that would make things easier.

gregmagdits commented 2 years ago

Sorry for the delayed response. We are in the process of testing this fix and will deploy an update tomorrow or early next week.

gregmagdits commented 2 years ago

This fix has been included in version 0.2.14. Closing issue