EdinburghGenomics / pyclarity-lims

Python interface to the GenoLogics LIMS server via its REST API.
MIT License
11 stars 4 forks source link

File encoding and CRLFs #11

Closed mwhamgenomics closed 7 years ago

mwhamgenomics commented 7 years ago

When a requests response object's text property is called, self.encoding is applied to self.content. Usually this is None and falls back to self.apparent_encoding.

In a case we were seeing though, a UTF-16-encoded XML file from a Windows machine was breaking this: since the Content-Type response header contained the string text, ISO-8859-1 encoding was being applied (see http://docs.python-requests.org/en/latest/user/advanced/?highlight=encoding#encodings).

Closes #10 by adding optional encodings and ability to convert CRLFs to \n.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.5%) to 68.307% when pulling e43d1796d29b125c349c79c477741d48cf2a4ca2 on file_encodings into 14dae08ac127b86df96b326ce466d4c4854dff2c on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.6%) to 68.433% when pulling d51f63fbf95fda40d4f9aea52bf0939929e9e2e4 on file_encodings into 14dae08ac127b86df96b326ce466d4c4854dff2c on master.