Git Product home page Git Product logo

flask-mwoauth's People

Contributors

cristiancantoro avatar halfak avatar legoktm avatar philiptzou avatar ricordisamoa avatar robinkrahl avatar sitic avatar urbanecm avatar valhallasw avatar yuvipanda 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-mwoauth's Issues

Utf-8 decode error.

Thanks for the package, it helped me a lot in handling OAuth with MediaWiki. It works fine, performs OAuth but I am encountering an error at callback url. The error is:

Traceback (most recent call last):
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/jwt/api_jws.py", line 191, in _load
    header = json.loads(header_data.decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 1: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/mwoauth/functions.py", line 264, in identify
    leeway=leeway)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/jwt/api_jwt.py", line 84, in decode
    payload, _, _, _ = self._load(jwt)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/jwt/api_jws.py", line 193, in _load
    raise DecodeError('Invalid header string: %s' % e)
jwt.exceptions.DecodeError: Invalid header string: 'utf-8' codec can't decode byte 0xe0 in position 1: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask_mwoauth/__init__.py", line 88, in oauth_authorized
    username = self.get_current_user(False)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/flask_mwoauth/__init__.py", line 166, in get_current_user
    mwoauth.AccessToken(**session['mwoauth_access_token']))
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/mwoauth/handshaker.py", line 127, in identify
    leeway=leeway, user_agent=self.user_agent)
  File "/home/rammanoj/.virtualenvs/wikitransfer/lib/python3.5/site-packages/mwoauth/functions.py", line 268, in identify
    "content: {0}".format(e))
mwoauth.errors.OAuthException: An error occurred while trying to read json content: Invalid header string: 'utf-8' codec can't decode byte 0xe0 in position 1: invalid continuation byte
127.0.0.1 - - [11/Jun/2019 23:41:18] "GET /oauth-callback?oauth_verifier=123123123&oauth_token=asdasdasd HTTP/1.1" 500 -

Hope to find a solution soon

The 'token' parameter was found in the query string, but must be in the POST body

I'm writing an application that uses this module to make modification to a Wikipedia page. The title of the bug is the error message I get from the server.

The code making the request is as follows:

edit_query = {'action': 'edit',
              'title': title.encode('utf-8'),
              'summary': summary.encode('utf-8'),
              'text': new_text.encode('utf-8'),
              'token': edit_token
              }

if section != '-1':
    edit_query['section'] = section

result = mwoauth.request(edit_query)

This code used to work previously (~ 1 year ago).

I think that now all edit requests should be handled as long requests.

Non-explicit demo

The demo.py file only shows the login/logout part. It would be very useful to also have an exemple of request use, beyond request({'action': 'query', 'meta': 'userinfo'}), for instance an example of an edit query.

How to set UserAgent in flask-mwoauth

Hey, I am getting a warning.

Sending requests with default User-Agent.  Set 'user_agent' on mwoauth.flask.MWOAuth to quiet this message.

So How to set user-agent to rid this message

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.