mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-10 20:37:50 +00:00
* Remove obsolete code * Remove scopes completely * Add hinting * Remove outdated function from docs/security * Revert "Add hinting" This reverts commit faeea24c28bf88eead4015feea8f4dbd750cec1c. * Change README for examples and other review fixes
27 lines
533 B
Python
Executable File
27 lines
533 B
Python
Executable File
#!/usr/bin/env python3
|
|
'''
|
|
Basic example of a resource server
|
|
'''
|
|
|
|
import connexion
|
|
|
|
PASSWD = {
|
|
'admin': 'secret',
|
|
'foo': 'bar'
|
|
}
|
|
|
|
def basic_auth(username, password):
|
|
if PASSWD.get(username) == password:
|
|
return {'sub': username}
|
|
# optional: raise exception for custom error response
|
|
return None
|
|
|
|
def get_secret(user) -> str:
|
|
return f"You are {user} and the secret is 'wbevuec'"
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = connexion.FlaskApp(__name__)
|
|
app.add_api('swagger.yaml')
|
|
app.run(port=8080)
|