milesrichardson / ParsePy

A relatively up-to-date fork of ParsePy, the Python wrapper for the Parse.com API. Originally maintained by @dgrtwo
MIT License
516 stars 184 forks source link

Fix for file uploads #157

Closed francisjervis closed 7 years ago

francisjervis commented 7 years ago

This was fixed in the comments for #15 by @treeguard but no PR was pushed to this branch: 115 data = data.encode('utf-8') > data = data and 124 request = Request(url, data, headers) > request = Request(url.encode('utf-8'), data, headers) Thanks!

milesrichardson commented 7 years ago

@francisjervis Can you confirm that this fix works on your setup? If so, would you mind submitting a PR? I don't have a self hosted parse-server with file support setup right now, so reproducing/testing would take longer than a few seconds.

If you need help with the workflow of editing the repository in your development environment and submitting the PR, what I recommend is: forking the repository, cloning it to the current directory, then sys.path.append(currentDirectory + 'ParsePy') before importing. Then you can edit the files in the ParsePy until you get it to work, then commit changes, git push origin master to your fork, and finally submit a PR on github.

milesrichardson commented 7 years ago

@francisjervis Fixed (safely, using a check to see if class is a File). :)

pull from master to use

newdev7 commented 7 years ago

Hi,

I'm using Python 3.6.0 for my project. I'm using this library (version='0.2.20170114') for storing the details in parse. When I tried to upload the file in Parse using File, it returns error saying <urlopen error unknown url type: b'https>.

The issue is with the url in the request. In the connection.py file, line 128, you are converting the url string to bytes using url.encode('utf-8'). This creates the issue. If I remove the encode and send the url as it is, then there is no issue. So I changed the code from request = Request(url.encode('utf-8'), data, headers) to request = Request(url, data, headers). Now it is working.

JianxunRao commented 7 years ago

@newdev7 Same issue.Your solution works for me. Thx!