-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose /v1/__api__ endpoint with the OAS spec.
Fixes #20
- Loading branch information
Rémy HUBSCHER
committed
Aug 7, 2017
1 parent
b343b85
commit 1a76a77
Showing
6 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
include *.rst LICENSE Makefile tox.ini | ||
include dev-requirements.txt | ||
include pollbot/api.yaml |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from aiohttp import web | ||
from .views import home, release | ||
from .views import home, release, utilities | ||
|
||
|
||
def get_app(loop=None): | ||
app = web.Application(loop=loop) | ||
app.router.add_get('/', home.redirect) | ||
app.router.add_get('/v1/', home.index) | ||
app.router.add_get('/v1/__api__', utilities.oas_spec) | ||
app.router.add_get('/v1/firefox/{version}', release.info) | ||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os.path | ||
|
||
from aiohttp import web | ||
import ruamel.yaml as yaml | ||
|
||
HERE = os.path.dirname(__file__) | ||
|
||
|
||
async def oas_spec(request): | ||
with open(os.path.join(HERE, "..", "api.yaml")) as stream: | ||
oas_spec = yaml.load(stream) | ||
return web.json_response(oas_spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters