This emulates api.github.com calls to lightningd/plugins
(github_user, github_repo)
| 9 | |
| 10 | @app.route("/api/repos/<github_user>/<github_repo>/contents/") |
| 11 | def github_plugins_repo_api(github_user, github_repo): |
| 12 | '''This emulates api.github.com calls to lightningd/plugins''' |
| 13 | user = escape(github_user) |
| 14 | repo = escape(github_repo) |
| 15 | canned_api = os.environ.get('REDIR_GITHUB') + f'/rkls_api_{user}_{repo}.json' |
| 16 | with open(canned_api, 'rb') as f: |
| 17 | canned_data = f.read(-1) |
| 18 | print(f'serving canned api data from {canned_api}') |
| 19 | resp = flask.Response(response=canned_data, |
| 20 | headers={'Content-Type': 'application/json; charset=utf-8'}) |
| 21 | return resp |
| 22 | |
| 23 | @app.route("/api/repos/<github_user>/<github_repo>/git/trees/<plugin_name>") |
| 24 | def github_plugin_tree_api(github_user, github_repo, plugin_name): |