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