Giter VIP home page Giter VIP logo

Comments (19)

benoitc avatar benoitc commented on July 17, 2024

Next release will be python3 compatible. Probably at the end of the month.

from restkit.

benoitc avatar benoitc commented on July 17, 2024

ok, finally got most of the bits to port restkit to py3. restkit will use http-parser in next release which support py3. net restkit will be online in 1 or 2 weeks with python3 support and somme enhancements. This version will also drop support for py2.5 .

from restkit.

gelendir avatar gelendir commented on July 17, 2024

Is there a status update on python 3 support ? I was thinking of hacking up a small program this weekend to learn python3 and was thinking of using restkit for REST stuff. (otherwise i'll just fall back to python2 and port when available)

from restkit.

benoitc avatar benoitc commented on July 17, 2024

available in 021104a .

from restkit.

gelendir avatar gelendir commented on July 17, 2024

I tried cloning 021104a and installing it, but when I import it in python3 there are a lot of errors. Exceptions still use python2 syntax and imported modules still use python2 names. Are you sure that's the right commit ?

from restkit.

benoitc avatar benoitc commented on July 17, 2024

you can't just import you need toiinstall it or patch it manually with
2to3 . work in progress anyway.

  • benoit

On Monday, June 20, 2011, gelendir
[email protected]
wrote:

I tried cloning 021104a and installing it, but when I import it in python3 there are a lot of errors. Exceptions still use python2 syntax and imported modules still use python2 names. Are you sure that's the right commit ?

Reply to this email directly or view it on GitHub:
#47 (comment)

from restkit.

rboulton avatar rboulton commented on July 17, 2024

Are you interested in using six (http://packages.python.org/six/) to make a version which doesn't need patching with 2to3? I've just done that for restpose-py, and it seemed a reasonable approach, though there may be harder issues to fix for restkit.

from restkit.

rboulton avatar rboulton commented on July 17, 2024

Scratch that comment - I see that installing does the 2to3 conversion - clever, and cunning.

I can't get it to work yet, though (though it does import ok once installed); may be I'm calling it wrong.

from restkit.

benoitc avatar benoitc commented on July 17, 2024

On Sunday, July 24, 2011, rboulton <
[email protected]>
wrote:

Scratch that comment - I see that installing does the 2to3 conversion -
clever, and cunning.

I can't get it to work yet, though (though it does import ok once
installed); may be I'm calling it wrong.

Reply to this email directly or view it on GitHub:
#47 (comment)

py3 version need some work. i'm currently refactoring the client to make it
happen.

  • benoit

from restkit.

rboulton avatar rboulton commented on July 17, 2024

Cool - I look forward to testing it.

from restkit.

gdamjan avatar gdamjan commented on July 17, 2024

seems to install fine with Python 3 (3.2.2 here), but a demo that tries OAuth fails with:

  File "/home/damjan/py/lib/python3.2/site-packages/restkit/__init__.py", line 107, in request
    headers=headers)
  File "/home/damjan/py/lib/python3.2/site-packages/restkit/client.py", line 450, in request
    ret = f.on_request(request)
  File "/home/damjan/py/lib/python3.2/site-packages/restkit/filters.py", line 95, in on_request
    oauth_req.sign_request(self.method, self.consumer, self.token)
  File "/home/damjan/py/lib/python3.2/site-packages/restkit/oauth2.py", line 472, in sign_request
    self['oauth_body_hash'] = base64.b64encode(sha(self.body).digest())
TypeError: Unicode-objects must be encoded before hashing

the code is :

consumer = oauth.Consumer(consumer_key, consumer_secret)
token = oauth.Token(oauth_token, oauth_token_secret)
auth = OAuthFilter("*", consumer, token)

req = request('https://userstream.twitter.com/2/user.json', filters=[auth])

from restkit.

gdamjan avatar gdamjan commented on July 17, 2024

regarding the last exception, it seems to be created by several occurences of body='' which is not translated by 2to3.
Maybe it should be replaced with body=bytes() (or body=None, and then change it in the code).
bytes() is available in 2.6, 2.7 and 3.2, didn't check others.

from restkit.

carlitux avatar carlitux commented on July 17, 2024

Hi, when will be ready py3 support?

from restkit.

benoitc avatar benoitc commented on July 17, 2024

sometimes next week. i've most of the tests passing on a test branch here, but I need to do a small refactoring first.

from restkit.

carlitux avatar carlitux commented on July 17, 2024

@benoitc thank you, if you need any help please let me know I am using restkit as base of one project.

from restkit.

autopulated avatar autopulated commented on July 17, 2024

restkit seems to work in Python 3 if I run 2to3 manually, but when I install restkit from PyPI that doesn't happen – should it? (I don't see any 2to3 setup in setup.py)

from restkit.

ari3s avatar ari3s commented on July 17, 2024

There is the 3 years old version of restkit on PyPI. Please, do you consider to finalize Python 3 version, and update PyPI?

from restkit.

dniq avatar dniq commented on July 17, 2024

The py3 support actually only requires a few things to be done, it seems:

  1. Search cStringIO or StringIO import and replace with "from io import StringIO"
  2. Replace "import urlparse" with "from urllib.parse import urlparse"
  3. Ditto for import urlunparse, parse_qs and parse_qsl
  4. Search all "except" statements and replace comma with " as ".

Haven't actually tested this yet, but import is no longer failing :)

from restkit.

akochepasov avatar akochepasov commented on July 17, 2024

There is a pull request to support python 3. Just not finished.

from restkit.

Related Issues (20)

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.