Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2/3 support for PyTumblr. #66

Merged
merged 1 commit into from Sep 1, 2017

Conversation

dianakhuang
Copy link
Contributor

I have updated the PyTumblr code to be both backwards compatible with Python 2 and forwards compatible with Python 3.

Some notes about what I've done:

  • Since the oauth2 library isn't Python 3 compatible, I've ripped it out and replaced it with requests-oauthlib, which has cleaned up the multipart posting quite a bit.
  • I've used the future library to be the compatibility layer for both Python 2 and Python 3, hence I've added it as a requirement.
  • I have done some manual testing in both Python 2 and 3 to ensure that the major functionality is still working the way we'd expect, including file uploads.
  • It seems like HTTPretty is giving us back values as Python bytestrings, so I had to update the tests to reflect that. If this is a concern, let me know.
  • There's some issues with running the tests under 3.4 due to how HTTPretty does its mocking of sockets (see this issue for more details), so I've only added 3.3 to be run on Travis. The client itself runs fine under Python 3.4.
  • There's also a few minor PEP8 fixes that I've tossed in as well.

I'm reading over the CLA right now. I'll try to get it sent in on Tuesday if you're are interested in ever trying to merge this. I'm happy to make updates based on any code review feedback you may have.

@yl3w
Copy link

yl3w commented Apr 27, 2015

@codingjester

@rbreu rbreu mentioned this pull request Jul 16, 2015
@midopa
Copy link

midopa commented Dec 9, 2015

+1

@codingjester
Copy link
Contributor

This LGTM, we should pull it in and try to cut a new release.

@dianakhuang
Copy link
Contributor Author

Sounds good to me. I submitted a CLA a bunch of months back. Let me know if I need to do anything else.

@fake-name
Copy link

Hello? Is this dead in the water?

No repo updates in the last 8 months.


@dianakhuang - For your py3k branch, don't forget to patch interactive_console.py. A simple 2to3 doesn't properly fix it, it does a bunch of oauth stuff I don't really understand at the moment.

@afk-mario
Copy link

@dianakhuang
Copy link
Contributor Author

Whoa, sorry I missed your comment @fake-name . If you check out the diff, I did redo a bunch of interactive_console.py because this change isn't just a simple 2to3 conversion. I had to replace the oauth2 library with requests-oauthlib because oauth2 (at least when I wrote this PR) doesn't/didn't support Python 3.

@pepoluan
Copy link

Why is this not yet merged?

@colindickie
Copy link

I've successfully modified the code to work on Python 3.5. It works fine on 'Text Posts' but 'Photo Posts' returns '401 Unauthourised' is this a 2/3 problem, or can anyone help? Thank you

@blairg23
Copy link

Why are we still having this problem a year later?

Copy link

@newfurniturey newfurniturey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holy 2-year delay, Batman! Still looks good to me =P

@jasonpenny Wanna merge and bring this repo back to life?

@jasonpenny jasonpenny merged commit 4a599d5 into tumblr:master Sep 1, 2017
@jasonpenny
Copy link
Contributor

💥

@colindickie I know it's been a while, but I couldn't reproduce the problem you had. If it is still happening for you, please open an issue with some more detail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet