Coder Social home page Coder Social logo

octoenergy / brickftp Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 4.0 25 KB

๐Ÿ Python Client for BrickFTP API (https://developers.brickftp.com/)

License: Other

Python 100.00%
api-client api-wrapper brickftp file-hosting file-upload ftp python-library python3

brickftp's People

Contributors

richardarpanet avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brickftp's Issues

Requests attempts to autoencode PUT request on line 63 of client.py

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.