All Projects → ProgrammingBuddies → programmingbuddies-api

ProgrammingBuddies / programmingbuddies-api

Licence: GPL-3.0 license
API backend for Programming Buddies (projects management)

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to programmingbuddies-api

ASD-ML-API
This project has 3 goals: To find out the best machine learning pipeline for predicting ASD cases using genetic algorithms, via the TPOT library. (Classification Problem) Compare the accuracy of the accuracy of the determined pipeline, with a standard Naive-Bayes classifier. Saving the classifier as an external file, and use this file in a Flask…
Stars: ✭ 14 (+0%)
Mutual labels:  flask-api
logtoes
Demo of Asynchronous pattern (worker) using Python Flask & Celery
Stars: ✭ 49 (+250%)
Mutual labels:  flask-api
TF2DeepFloorplan
TF2 Deep FloorPlan Recognition using a Multi-task Network with Room-boundary-Guided Attention. Enable tensorboard, quantization, flask, tflite, docker, github actions and google colab.
Stars: ✭ 98 (+600%)
Mutual labels:  flask-api
flask-rest-api
This program shows how to set up a flaskrestapi with postgre db, blueprint, sqlalchemy, marshmallow, wsgi, unittests
Stars: ✭ 28 (+100%)
Mutual labels:  flask-api
flask-arrested
Flask-Arrested: A Framework For Rapidly Building REST APIs with Flask.
Stars: ✭ 40 (+185.71%)
Mutual labels:  flask-api
username-availability-checker
Live at : https://username-check.herokuapp.com/
Stars: ✭ 84 (+500%)
Mutual labels:  flask-api
Flask-Deep-Learning-NLP-API
Flask API to productize a document classification model. Classification model was built using Keras with tensorflow backend
Stars: ✭ 26 (+85.71%)
Mutual labels:  flask-api
oms.py
🔨 A micro-framework for the OMS, and code written in Python 3.6+.
Stars: ✭ 106 (+657.14%)
Mutual labels:  flask-api
scraped-tvtime-api
A free TVTime API based on scraping TVTime website. No API key required
Stars: ✭ 23 (+64.29%)
Mutual labels:  flask-api
Water-classifier-fastai
Deploy your Flask web app classifier on Heroku which is written using fastai library.
Stars: ✭ 37 (+164.29%)
Mutual labels:  flask-api
avatar-gen
pillow 生成头像,中英文首字母或者随机像素化。Using pillow for generate avatars, first letter of string in Chinese and English or random pixel like avatars.
Stars: ✭ 31 (+121.43%)
Mutual labels:  flask-api
CricketAPI
A Flask API Server with options to get live scores, live commentary and scorecards.
Stars: ✭ 21 (+50%)
Mutual labels:  flask-api
Nectus
A boilerplate Flask API for a Fullstack Project with some additional packages and configuration prebuilt. ⚙
Stars: ✭ 32 (+128.57%)
Mutual labels:  flask-api
flask-skeleton-api
A boilerplate Python API made with Flask used by Ceuma Group developers team.
Stars: ✭ 18 (+28.57%)
Mutual labels:  flask-api

Programming Buddies API

API backend for Programming Buddies (projects management)

API documentation

The documentation is dynamically generated by the server using Swagger and Swagger UI

  • To view the documentation run the server using one of the set up guides below and then head to /docs endpoint

Set up guide: The simple way

Set up guide: The 'bothersome' way

Requirements:

  • Set up your environment
  • MySQL Community Server
    • Add line CONNECT=mysql+pymysql://<user>:<password>@localhost:3306/<database name> to your .env file to specify connection parameters
  • Pipenv
    1. Run python -m pip install pipenv to install pipenv
    2. Run pipenv install inside the repository
      • If you have multiple Python versions installed you might need to specify which one to use pipenv install --python=python3.7
  • SSL
    • On Mac or Linux install the OpenSSL tool and run openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365 inside the repository
    • On Windows
      1. Install OpenSSL for Windows here
      2. Execute the same command as on Mac inside the project directory

Run the server:

  • pipenv run python src/runserver.py
    • Run with flag --reset-db to drop and recreate all tables on start
  • For information on how to authenticate for the API, see authentication

Environment

  1. Create a file named .env
    • Add line FLASK_ENV=development to have the server automatically restart on file changes
  2. Add line APP_SECRET=somepassword as app secret. This is used to sign sessions among other things and is required
  3. Obtain credentials for GitHub OAuth
    • Under your GitHub account Settings go to Developer settings and OAuth Apps
    • Create a new one and set the homepage url to https://localhost:5001/ and Authorization callback to https://localhost:5001/login/github/authorized
    • Copy the Client Id and Client Secret from that site and save them in .env as GITHUB_ID and GITHUB_SECRET respectively
  4. Furthermore a JWT_SECRET_KEY is required for signing the JWT-tokens
    • Pick a strong passphrase so that attackers can't brute-force it and sign tokens distinguishing as your server

Your .env file should now look something like example.env

Authentication

  • To authenticate you have to specify several attributes
    • account - currently github is the only supported value
    • username - your username of account on specified platform in the previous point
    • redirect - url where should you be redirected after authenticating with OAuth
  • Put it all these together https://<url:port>/<login-or-register>?account=<account>&username=<username>&redirect=<redirect>
    • e.g.: https://localhost:5001/<login-or-register>?account=github&username=freddy&redirect=https://localhost:5001 will login-or-register using GitHub account with name freddy while developing local with the server hosted on localhost:5001
  • You will be redirected to the specified url and get data with it
    • If the request failed - when logging in and user was not registered (user not found in the database) or there was any internal error, you will get an error message and code
    • If the request succeeded - you will get a JWT token in the URL, that is what you need to authenticate
  • Add to your requests Authorization header with a value Bearer <token> where you replace <token> with your token acquired in the step above

Login

  • /login route logs in if the user exists in the database, otherwise returns a error message and code in the URL
  • Usage: https://<url:port>/login?account=<account>&username=<username>&redirect=<redirect>
    • e.g.: https://localhost:5001/login?account=github&username=freddy&redirect=https://localhost:5001

Register

  • /register route either logs in if the user exists in the database or registers (creates) a new user, in case of failure returns a error message and code in the URL
  • Usage: https://<url:port>/register?account=<account>&username=<username>&redirect=<redirect>
    • e.g.: https://localhost:5001/register?account=github&username=freddy&redirect=https://localhost:5001

Testing

  • To run multiple tests just specify the directory which contains them for example pipenv run pytest tests/
    • This will run all the tests in the tests directory
  • If you want to run test cases only in a particular file, then just give the full file path pipenv run pytest tests/example.py

Tech stack:

  • Python
  • Flask
  • MySQL
  • pyOpenSSL
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].