singingwolfboy / flask-dance

Doing the OAuth dance with style using Flask, requests, and oauthlib.
https://pypi.python.org/pypi/Flask-Dance/
MIT License
997 stars 156 forks source link

added twitter oauth 1.0 and 2.0 #424

Closed kotyatokino closed 7 months ago

kotyatokino commented 8 months ago

I just confirmed twitter oauth 1.0 and 2.0 login. And I'm not native speaker of English. So please help me to fix variable name or some naming part for native speakers.

and userland test code like this.

from flask_dance.contrib.twitter import make_twitter2_blueprint as make_bp, twitter2 as sns bp = make_bp( api_key=mcfg.strTWappid, api_secret=mcfg.strTWappsec, scope="tweet.read users.read offline.access", redirect_url="/captiveportal/twitter2", authorized_url="/authorized" )

: : me = None try: me = sns.get("2/users/me") except Exception as e: g.ilog("Twitter Logged in but something wrong(%s). Redirect to loginpage(%s,%\ s)" % (str(e),tupURL[1]["usermac"],tupURL[1]["magic"])) return redirect(url_for("%s.login" % strSNSname))

if(me.status_code < 200 or me.status_code >= 300):
    g.elog("Twitter auth failed redirect to login: %s ( %s )(%s,%s)" % (me.text,m\

e.status_code,tupURL[1]["usermac"],tupURL[1]["magic"])) return redirect(url_for("%s.login" % strSNSname))

j = me.json()
codecov[bot] commented 7 months ago

Codecov Report

Merging #424 (ae51d3d) into main (27add75) will decrease coverage by 7.93%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
- Coverage   96.35%   88.43%   -7.93%     
==========================================
  Files          37       38       +1     
  Lines        1070     1098      +28     
==========================================
- Hits         1031      971      -60     
- Misses         39      127      +88     
Files Coverage Δ
flask_dance/contrib/twitter.py 0.00% <0.00%> (ø)

... and 30 files with indirect coverage changes

:mega: Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

singingwolfboy commented 7 months ago

It doesn't make sense to have both OAuth 1 and OAuth 2 for a single provider. This code is missing tests and documentation. The linter is failing. In addition, I don't want to be the maintainer for this code, so my email address does not belong in the __maintainer__ variable.

Frankly, I don't want to support Twitter in this library anymore. I'm not happy with the way that Elon Musk has been running it, and I've stopped using it myself.

kotyatokino commented 7 months ago

Frankly, I don't want to support Twitter in this library anymore. I'm not happy with the way that Elon Musk has been running it, and I've stopped using it myself.

I would like to know your thoughts before writing the code. I don't want to cause you any trouble, so I'd like to close this pull request. I don't have as much skill as you, so I don't think I can maintain it at the same level as you. I can write my own program to solve the problem.