8000 GitHub - paulomujuru/python_api: Web API with python and mysql database
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

paulomujuru/python_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You can install Docker by following this link

Once docker is installed you will require Docker Compose (for Windows users this comes preinsatlled with Docker).

Linux

Install Compose on Linux systems On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl command in your terminal to download the binaries. These step-by-step instructions are also included below.

For alpine, the following dependency packages are needed: py-pip, python-dev, libffi-dev, openssl-dev, gcc, libc-dev, and make.

Run this command to download the current stable release of Docker Compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.

For example:

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Optionally, install command completion for the bash and zsh shell.

Test the installation.

$ docker-compose --version
docker-compose version 1.27.4, build 1110ad01

Usage

Linux

sudo docker-compose build
sudo docker-compose up

Windows

docker-compose build
docker-compose up

If no errors have occured than you should be able access the API on

http://localhost:5000

API Example Requests

Register a User

Method: POST

Headers:

{
    "Content-Type": "application/json"
}

Body:

{
    "username": "Test",
    "password": "12345678"
}

Reponse Code: 200

Reponse:

{
  "Message": "User Registered Successfully",
  "data": {
    "username": "Test",
    "password": "gAAAAABgCrmkZxY39eeSodYrItOVx47wgza37ty-6fDTb-5L_dLufmNvFuLK8DqYLBdN7mdmenFV2G1LcB6cdqUvadfRxCmxjA=="
  }
}

Login a User

Method: POST

Headers:

{
    "Content-Type": "application/json"
    "Autherization": "Basic {username:password}"
}

Body:

{
    "username": "Test",
    "password": "12345678"
}

Reponse Code: 200

Reponse:

{
  "Message": "Login Successful"
}

Create a profile

Method: POST

Headers:

{
    "Content-Type": "application/json"
    "Autherization": "Basic {username:password}"
}

Body:

{
    "name": "Test",
    "age": "12",
    "favourite_color": "Pink",
    "favourite_OS": "Ubuntu" 
}

Reponse Code: 200

Reponse:

{
  "data": [
    "Test",
    "12",
    "Pink",
    "Ubuntu"
  ]
}

Search Profiles

Method: POST

Headers:

{
    "Content-Type": "application/json"
    "Autherization": "Basic {username:password}"
}

Body:

{
	"profileid": 2
}

Reponse Code: 200

Reponse:

{
  "data": {
    "name": "Test",
    "age": "12",
    "favourite_color": "Pink",
    "favourite_OS": "Ubuntu"
  }
}

Edit Profile

Method: PUT

Headers:

{
    "Content-Type": "application/json"
    "Autherization": "Basic {username:password}"
}

Body:

{
	"profileid": 2,
    "name": "foo"
}

Reponse Code: 200

Reponse:

{
  "data": {
    "name": "foo",
    "age": "12",
    "favourite_color": "Pink",
    "favourite_OS": "Ubuntu"
  }
}

About

Web API with python and mysql database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0