added micropub_endpoint to authorized_handler response
This commit is contained in:
parent
d039e29f30
commit
6db7529f4a
|
@ -16,13 +16,15 @@ def micropub_callback(resp):
|
|||
<body>
|
||||
<ul>
|
||||
<li>me: {}</li>
|
||||
<li>endpoint: {}</li>
|
||||
<li>token: {}</li>
|
||||
<li>next: {}</li>
|
||||
<li>error: {}</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
""".format(resp.me, resp.access_token, resp.next_url, resp.error)
|
||||
""".format(resp.me, resp.micropub_endpoint, resp.access_token,
|
||||
resp.next_url, resp.error)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
|
|
|
@ -178,8 +178,8 @@ class Micropub:
|
|||
|
||||
# success!
|
||||
access_token = tdata.get('access_token')[0]
|
||||
return AuthResponse(me=confirmed_me, access_token=access_token,
|
||||
next_url=next_url)
|
||||
return AuthResponse(me=confirmed_me, micropub_endpoint=micropub_url,
|
||||
access_token=access_token, next_url=next_url)
|
||||
|
||||
def _discover_endpoints(self, me):
|
||||
me_response = requests.get(me)
|
||||
|
@ -202,6 +202,7 @@ class AuthResponse:
|
|||
Attributes:
|
||||
me (string): The authenticated user's URL. This will be non-None if and
|
||||
only if the user was successfully authenticated.
|
||||
micropub_endpoint (string): The endpoint to POST micropub requests to.
|
||||
access_token (string): The authorized user's micropub access token.
|
||||
next_url (string): The optional URL that was passed to authorize.
|
||||
error (string): describes the error encountered if any. It is possible
|
||||
|
@ -209,8 +210,10 @@ class AuthResponse:
|
|||
will fail, in which case me will be non-None, and error will describe
|
||||
this condition.
|
||||
"""
|
||||
def __init__(self, me=None, access_token=None, next_url=None, error=None):
|
||||
def __init__(self, me=None, micropub_endpoint=None,
|
||||
access_token=None, next_url=None, error=None):
|
||||
self.me = me
|
||||
self.micropub_endpoint = micropub_endpoint
|
||||
self.access_token = access_token
|
||||
self.next_url = next_url
|
||||
self.error = error
|
||||
|
|
5
setup.py
5
setup.py
|
@ -11,8 +11,8 @@ from setuptools import setup
|
|||
|
||||
setup(
|
||||
name='Flask-Micropub',
|
||||
version='0.1',
|
||||
url='https://indiewebcamp.com/Flask-Micropub/',
|
||||
version='0.1.1',
|
||||
url='https://github.com/kylewm/flask-micropub/',
|
||||
license='BSD',
|
||||
author='Kyle Mahan',
|
||||
author_email='kyle@kylewm.com',
|
||||
|
@ -32,6 +32,7 @@ setup(
|
|||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Operating System :: OS Independent',
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
||||
|
|
Loading…
Reference in New Issue