octoenergy / brickftp Goto Github PK
View Code? Open in Web Editor NEW๐ Python Client for BrickFTP API (https://developers.brickftp.com/)
License: Other
๐ Python Client for BrickFTP API (https://developers.brickftp.com/)
License: Other
Currently I'm using the BrickFTP python client to upload files to BrickFTP, the issue arises when I attempt to upload a file containing the character "\u2019", I get the following error:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 89154: Body ('โ') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
I already tried specifying the uft-8 encoding despite it being the default encoding the upload function on line 48 of client.py uses to no avail. After some research I found that the previously mentioned error is because the Requests library attempts to auto-encode what it's uploading based on the first 127 characters of the data. See: https://stackoverflow.com/questions/41030128/str-encoding-from-latin-1-to-utf-8-arbitrarily
I was able to solve this by modifying line 63 of client.py from this:
resp = requests.put(upload_uri, data=input_file.read())
to this:
resp = requests.put(upload_uri, data=input_file.read().encode(encoding))
I will be submitting a PR shortly.
Hi!
Thank you so much for providing this resource. I wanted to let you and your users know that there is now a BrickFTP (Files.com) official SDK available here: https://github.com/Files-com/files-sdk-python
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.