usetheapi / flask_url_discovery Goto Github PK
View Code? Open in Web Editor NEWFlask extension for discovering urls in a service. Automatically expose urls for a service. Manage urls exposure settings.
License: MIT License
Flask extension for discovering urls in a service. Automatically expose urls for a service. Manage urls exposure settings.
License: MIT License
Flask-UrlDiscovery-1.1.1 , flask-1.0.2 , Python 3.6.7
I have in __init__.py
:
from flask import Flask
from flask_url_discovery import url_discovery
def create_app():
app = Flask(__name__)
url_discovery(app)
app.register_blueprint(...
where I added only 2 lines, to import url_discovery and to use it.
With these two lines I get this trace:
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/hans/.local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/hans/.local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/hans/.local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/hans/.local/lib/python3.6/site-packages/flask_url_discovery/app_registry.py", line 18, in expose_routes
links = jsonify(current_app.ud_links)
File "/home/hans/.local/lib/python3.6/site-packages/werkzeug/local.py", line 348, in __getattr__
return getattr(self._get_current_object(), name)
AttributeError: 'Flask' object has no attribute 'ud_links'
Is this a bug in flask_url_discovery ? Something I did wrong ? Any help appreciated.
must support case:
@app.route("/route/first")
@app.route("/route/second")
def func():
return
active_urls
field has to become a list()
Following steps required:
app
from Flask
UrlDiscovery.add_private_link()
to url_discovery function to provide stateless extension.The only time flask_urldiscovery has access to flask app is when url_registry called and on url_discovery call
url_discovery does not validate routes with params like:
@route("/test/app/<id>", methods=["GET"])
def test_adpp(id):
return "HELLO"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.