Skip to main content

A simple api package

Project description

Simple python api using flask and sqlalchemy

Create/update with PUT

Description: Saves/updates the given user's name and date of birth in the database. Request: PUT /hello/ {“dateOfBirth": "YYYY-MM-DD" } Response: 204 No Content

Note: must contains only letters. YYYY-MM-DD must be a date before the today date.

See message with GET

Description: Returns hello birthday message for the given user Request: Get /hello/ Response: 200 OK

**Response Examples: ** A. If username's birthday is in N days: { "message": "Hello, ! Your birthday is in N day(s)" } B. If username's birthday is today: { "message": "Hello, ! Happy birthday!" }

APP variables

Application listens on localhost:5000 by default, but you can set environment variables

export APP_HOST=someadress
export APP_PORT=8080

APP dependencies

Application uses postgresql and need following environment values:

export SQLALCHEMY_DATABASE_URI="postgresql://user:somestrongpassword@localhost:5432/users"

Starting application

To start application type:

python -m roverqaz_simple_api

Also you can install application with pip:

pip install --upgrade roverqaz_simple_api
python -m roverqaz_simple_api

Unit tests

To run unit tests enter:

python tests/test.py

Note: maybe you will need enter

export PYTHONPATH=$(pwd) for running tests

Tests includes for steps

  • put unittest user with birtdate on 31-12-{now.year-1}
  • gets unittest user and checks response message
  • updates unittest user's birtdate to today
  • gets unittest user and checks response message

Package on PyPi

See roverqaz-simple-api

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

roverqaz_simple_api-0.1.9.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

roverqaz_simple_api-0.1.9-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file roverqaz_simple_api-0.1.9.tar.gz.

File metadata

  • Download URL: roverqaz_simple_api-0.1.9.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for roverqaz_simple_api-0.1.9.tar.gz
Algorithm Hash digest
SHA256 99fbb79b751e23bed7858da193b104794ef255a9513a8a044faa69bd82c1e526
MD5 e1769426de61e690f1ee8676c00eaefa
BLAKE2b-256 34b3bdd62f438023073eacd510bed44b88f78417de8f6db6df89f94a9f6dd873

See more details on using hashes here.

File details

Details for the file roverqaz_simple_api-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: roverqaz_simple_api-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for roverqaz_simple_api-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 29a57ec8b002e61634ccf3d56868f3d94e99fb3c17e82a850aa1ee63df8b4ec4
MD5 6420c6d51dc770e87681d80af2c507d2
BLAKE2b-256 912663814911befd9b7434f4fbc1529fb29a14f9ff05bf5503d123c7437c0854

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