Skip to content

dfugate/symplpay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

symplpay

Introduction

symplpay is a small web app which demonstrates how to combine several highly-related REST API calls on server A into a single REST API call for server B. One reason for implementing such a pattern is to make API consumers' lives easier.

License

This software is distributed under the MIT License.

Dependencies

  • Ubuntu 18.04, Ubuntu 20.04, or the latest-and-greatest release of Windows 10. While symplpay may work as-is on other Linux OSVs, all testing was performed against the latest HWE LTS versions of Ubuntu and also Windows 10
  • 64-bit Python 3.6 or higher
  • Python's requests_oauthlib 3rd party package. Instructions are given below on installing this which is needed to handle the OAuth 2.0 protocol with the remote server
  • (Optional) Python's gunicorn 3rd party package. Again, there are instructions below on installation which is only necessary to host the local REST API using HTTPS on Linux

Known Issues

  • The "--ssl" flag doesn't work on Windows 10
  • The logs page doesn't work without usage of the "--debug" flag. By-Design as availability of this functionality in production would be considered a security issue without appropriate authorization (not implemented by symplpay)

Installation

Python

  • Ubuntu 18.04/20.04 HWE LTS: open a Terminal and run sudo apt install python3. Verify successful installation by running python3 --version -> the reported version needs to be >= 3.6.
  • Windows 10: download 64-bit Python 3.9 and install. Once complete, open a cmd.exe and run python --version to ensure the 3.x version of Python appears first in your %PATH%.

IMPORTANT NOTE: all remaining instructions assume you're running Linux. If not the case, simply substitute "python" for "python3", "pip" for "pip3", and "cmd.exe" for "Terminal" in any commands below.

Python's requests_oauthlib Package

From a Terminal:

  1. pip3 install requests_oauthlib
  2. Run python3 -c "import oauthlib" to confirm the package was successfully installed -> no output and an exit code of 0 is expected.

(Optional - for HTTPS support in Linux) Python's gunicorn Package

From a Terminal:

  1. (Ubuntu) sudo apt install openssl. Probably unnecessary on most systems, but better safe than sorry;)
  2. pip3 install gunicorn
  3. Run python3 -c "import gunicorn" to confirm the package was successfully installed -> no output and an exit code of 0 is expected.
  4. IMPORTANT NOTE: you must supply the "--ssl" parameter to the python3 -m symplpay.server ... command in the Server Initialization Instructions below to enable HTTPS. I.e., this does not happen automatically simply because you're on Linux

Running the Web App

Open a new Terminal:

  1. export PYTHONPATH=. (only if you do not already have Python configured to look in the current directory for Python files)
  2. cd <where-you-dropped-this>/symplpay
  3. Run python3 -m symplpay.server -h to see what configurable server parameters are available...
  4. python3 -m symplpay.server --client_id <your ID> --client_secret <your secret> --debug to start the server
  5. Open http://localhost:8080 (or https://localhost:8080 if you supplied the "--ssl" flag) in your favorite web browser
  6. Use curl, Postman, etc. to invoke the server's single API, http(s)://localhost:8080/compositeUsers/:userId

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published