cenkalti / putio.py

A python wrapper for put.io APIv2
http://put.io
MIT License
72 stars 41 forks source link

Download file breaks with international characters in name #21

Closed datashaman closed 8 years ago

datashaman commented 8 years ago

Hi,

Trying to download a file with name including non-ASCII characters, for example Röyksopp, results in an exception:

# encoding: utf8

import putio

client = putio.Client('')

f = client.File({
    'id': 'file',
    'name': 'Röyksopp',
    'size': 0,
    'content_type': 'text/plain',
    'crc32': '00000000',
})

f.download('/tmp')

Exception:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

I have a fix, which I'll push now.