cenkalti / putio.py

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

urljoin and builtin type #32

Closed ghost closed 7 years ago

ghost commented 7 years ago

Requests, by Kenneth Reitz, doesn't officially support python < 2.6 and, judging by the package classifiers, putio.py doesn't claim to support python < 2.7. As such, I think using the builtin type instead of __class__ is better than chaining underscored attributes.

urljoin provides a standard to way to handle the path argument of Client.request: https://url.spec.whatwg.org/#syntax-url-path-relative

As of right now the Client.request method expects a path-absolute-URL string that is handled in a non-standard way.

I would expect /files to resolve to https://api.put.io/files and not https://api.putio/v2/files because /files is a path-absolute-URL.

This PR addresses the aforementioned.

cenkalti commented 7 years ago

type(x) and x.__class__ behave same for new style classes.

I like API endpoint names to start with /. And the behavior is documented in https://github.com/nuclear-foss/bitport.py/blob/995fb9514166905aa2b4d84c211ab072464936e1/putiopy.py#L180

@nuclear-foss thank you for the contribution but I don't want to merge this PR.

ghost commented 7 years ago

Your preference is non-intuitive. If you can't follow standards then you won't be receiving anymore PRs from me.

Good luck with that. :+1: