mirror of
https://github.com/google/pybadges.git
synced 2026-01-04 18:30:10 +01:00
Add server example with serves badges
This commit is contained in:
26
server-example/app.py
Normal file
26
server-example/app.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Example CI server that serves badges
|
||||
|
||||
from flask import Flask
|
||||
import pybadges
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def serveBadges():
|
||||
# First example
|
||||
badge_arg = dict(
|
||||
left_text='build',
|
||||
right_text='passing',
|
||||
right_color='#008000'
|
||||
)
|
||||
badge = pybadges.badge(**badge_arg)
|
||||
|
||||
# Second example
|
||||
secondBadge = pybadges.badge('chat', 'online')
|
||||
|
||||
return badge + "\n" + secondBadge
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
Reference in New Issue
Block a user