Giter Club home page Giter Club logo

py-oauth2's People

Contributors

alswl avatar grigi avatar liluo avatar skiyo avatar waawal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-oauth2's Issues

Large file cause MemoryError

Hi there, it's me again.
Since the last time I asked about download large file streamly via OAuth2 , I eventually found there's possibly a bug in your code. I noticed an unnormal RAM usage which would even use up all RAM on old computers. This happens during the last few seconds of downloading a file (50+ MB).

And I found this is somethins related to this line:

self.body = response.text

If changed to:

        options = {'parse': 'text'}
        options.update(opts)
        if options['parse'] in ('text', 'query', 'json', ):
            self.body = response.text

would solve this problem, and also lower the RAM usage during small size file downloading.

strem parameter not passed in client.request() method

Hi. I was using this little tool for OAuth 2 authentication, and I recently found something confusing.

Think about downloading a large file via OAuth 2. 'Cause the file is very large, I don't want the client to read it all into memory at once. Instead, I thought I could use the iter_content() method of requests.models.Response to write the file to disk block by block, since your tool uses requests. Yet I've read your code, and did not see the stream parameter being passed to the client.request() method, and I think this might be a bug.

As far as I know, requests does require this parameter to be passed to Request to work as the way I described above.

Could you please explain some of your code? If this is rather a feature or something designed than a bug, I'd be glad to hear from you about the right way to do my work.

getting the access_token /oath2callback

client = Client(CLIENT_ID, CLIENT_SECRET,

                site='https://www.googleapis.com/oauth2/v1',

                authorize_url='https://accounts.google.com/o/oauth2/auth',

                token_url='https://accounts.google.com/o/oauth2/token')



print '-' * 80

authorize_url = client.auth_code.authorize_url(redirect_uri=REDIRECT_URL, 

                                               scope=SCOPE)





app = Flask(__name__)







@app.route("/")

def hello():

    print "hello world"

    return redirect(authorize_url)



@app.route("/oauth2callback")

def oauth2callback():

How do i get access to user info in oauth2callback in this example?

使用的时候发现了两处bug

首先感谢作者提供了这么简洁的工具。已经在使用了,总体感觉很好用,但是用的时候还是发现了两处bug。

第一个地方是在libs/access_token.py 82行左右,原文是:
opts['body'][self.opts['param_name']] = token
我想作者的原意应该是:
opts['body'][self.opts['param_name']] = self.token

第二个地方是在libs/request.py ,因为url参数和配置项都是通过 **opt 传递,但是如果接口参数和配置项重名的话就报错了,我觉得应该有一个params的配置项,这个配置项传递url的参数。奇怪的是我在libs/access_token.py 的__set_token 这个函数中看到了params配置项,但是在libs/request.py中没有看到对其进行处理。

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.