Skip to content

Instantly share code, notes, and snippets.

<!-- templates/dashboard.html -->
<!doctype html>
<html>
<head>
<title>Github OAuth</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- load bulma css -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- load fontawesome -->
<style>
body { padding-top:70px; }
</style>
# -*- coding: utf-8 -*-
"""This module has methods that are used in the other modules in this package."""
import os
import requests
def set_flask_environment(app) -> str:
"""Set the flask development environment.
# -*- coding: utf-8 -*-
"""This module creates the routes for our API."""
from flask import render_template, request
from API import app
from API.helpers import get_access_token, get_user_data
@app.route('/index', methods=['GET'])
<!-- templates/index.html -->
<!doctype html>
<html>
<head>
<title>Github OAuth</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- load bulma css -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- load fontawesome -->
<style>
body { padding-top:70px; }
# -*- coding: utf-8 -*-
"""This module contain the confuguration for the application."""
import os
from dotenv import load_dotenv
load_dotenv()
class BaseConfig():
@app.route('/home', methods=['GET'])
def home() -> str:
"""Provide the user with the option to register with GitHub."""
return render_template('index.html', client_id=app.config['CLIENT_ID']), 200
# -*- coding: utf-8 -*-
"""This module creates the routes for our API."""
from API import app
@app.route('/index', methods=['GET'])
@app.route('/', methods=['GET'])
def index() -> dict:
"""Handle get requests to /index route.
# -*- coding: utf-8 -*-
"""This module contains initialization code for the API package."""
from dotenv import load_dotenv
from flask import Flask
load_dotenv()
app = Flask(__name__)
# -*- coding: utf-8 -*-
"""This module sets up the fixtures that will be used in our testing."""
import pytest
from API import app
@pytest.fixture
def client():
[pytest]
minversion = 6.0
addopts = -ra -q
testpaths =
tests/unit