Coder Social home page Coder Social logo

kin's Introduction

kin

this is a kin api demo written with flask,peewee(and sqlite),marshmallow,aargon, for registering users, verifying users, sending sms messages and viewing sms history

design thoughts:

  • the design idea was that each user belongs to a plan(like student, private(regular), team, company...) that contains the sms cost per message, and the initial credit for that plan.
  • each user being created have a FK to a plan(in this demo they all belong to a "regular" which is being created on the first request thanks to defaults), and the initial credit is copied from that plan to his/her user record to be used this allows to change the plan sms cost for all the plan users, with out updating all the users
  • after the user is being verfied, he/she can send sms messages with the cost specified in the user plan
  • and the user can also see its list of messages(content and date) and also its details+current balance

how to run

  1. in order to run this you need an account in nexmo
  2. export the following env paramters

export NEXMO_API_KEY=<your nexmo api key> export NEXMO_API_SECRET=<your nexmo api secret>

  1. there is an optional seed key used for hashing , but you can skip it for now

export SECRET_KEY=<your random letters and number to be used as seed>

  1. **use virtual and activate it ** virtualenv venv;source venv/bin/activate
  2. install dependencies pip install -r requirements.txt
  3. run the flask app python app.py

available endpoints

you can use one of the 5 endpoints

for registering new users :

POST: http://127.0.0.1:8000/api/v1/users/register

for verifying new users :

POST: http://127.0.0.1:8000/api/v1/users/verify

for sending sms messages :

POST: http://127.0.0.1:8000/api/v1/users/send

for viewing sms history

GET: http://127.0.0.1:8000/api/v1/users/messages

for viewing user current status

GET: http://127.0.0.1:8000/api/v1/users/info

kin's People

Contributors

kobimic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.