Skip to main content

Generator a github card for flask web application

Project description

flask-githubcard

A flask's extension to generate a github card for yourself.

中文文档

Quick Start

pip install flask-githubcard

Step 1: Initial the extension

from flask import Flask
from flask_githubcard import GithubCard
app = Flask(__name__)
githubcard = GithubCard(app)

Step 2: In your <head> section of your base template add the following code:

<head>
    {{githubcard.init_css()}}
    {{githubcard.init_js()}}
</head>

Step 3: Render the github card in your template.

<div>
    {{githubcard.generate_card()}}
</div>

Open your browser and visit your web page, github card like bellow here:

1623293427414.png

Advanced

Configure yourself github info

from flask import Flask
from flask_githubcard import GithubCard
app = Flask(__name__)

githubcard = GithubCard(app)
app.config['GITHUB_USERNAME'] = 'weijiang1994'
app.config['GITHUB_REPO'] = 'Blogin'

Choose theme

<head>
    {{githubcard.init_css(theme='darkly')}}
</head>
<div>
    {{githubcard.generate_card(theme='darkly')}}
</div>

Darkly Theme

1623294104103.png

Use Ajax

from flask import Flask
from flask_githubcard import GithubCard
app = Flask(__name__)
githubcard = GithubCard(app)

@app.route('/ajax')
def ajax():
    return jsonify(githubcard.create(theme='darkly').get_raw_data())

Note

  • Due to the use of GitHub's API without authorization, the number of unique IP visits is limited to 60 times per hour, if more than 60 times, 403 will be reported. If the frequency of access is too high, please go to the authorized account on GitHub
  • In the case where the network state is not good, the access to Github will have timeout, which may cause the web page to not open!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-Githubcard-1.0.4.tar.gz (204.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Flask_Githubcard-1.0.4-py2.py3-none-any.whl (205.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file Flask-Githubcard-1.0.4.tar.gz.

File metadata

  • Download URL: Flask-Githubcard-1.0.4.tar.gz
  • Upload date:
  • Size: 204.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for Flask-Githubcard-1.0.4.tar.gz
Algorithm Hash digest
SHA256 485256db5ac3e52ef5bb27ea778d022d814c88ad7ba535055a59b2e4c712f594
MD5 294913896db54e080dde513023f449cd
BLAKE2b-256 de6e09fe4e06aeae21c0d5c44840c35dea4b3287ed8debb4448a65848a32dcbe

See more details on using hashes here.

File details

Details for the file Flask_Githubcard-1.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: Flask_Githubcard-1.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 205.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for Flask_Githubcard-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 628eb0760affd8f50f0c86bba181de8a59b3f7deb951e32a4dfe6507c03634d2
MD5 9c1e8ce606ea9a1d6f41888c68a96715
BLAKE2b-256 cb859767e14f1203beef91a07ac24a2763ed91714a4308064177c9c2ea9889c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page