Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

mORMot_External_Authentication

External connection to a server mormot

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

mORMot_External_Example

This project contains examples demonstrating how to connect to a server mormot, using an Authenticated HTTP connection.

Getting Started

Prerequisites

  • python 3.6
  • requests 2.12.4

Installing

bash
pip install -r requirements.txt

Example

running the example:

bash
python mormort_http_client.py

example in code:

python
                                     #host,       port,   root
HTTP_CLIENT = AutheticatedHTTPClient('localhost', '888', 'root')
SESSION = HTTP_CLIENT.login(
  'Admin', #User
  '67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd' #Hashed Password
)
if SESSION:
    from pprint import pprint
    print("Logged in session:")
    pprint(SESSION.__dict__)

    METHOD = 'ParamMethod'
    PARAMETERS = {'Param1': '4'}

    REQUEST = HTTP_CLIENT.request(METHOD, PARAMETERS)
    print("Making request: {}".format(METHOD))
    pprint(REQUEST.json())

    METHOD = 'Mehod'
    PARAMETERS = {}

    REQUEST = HTTP_CLIENT.request(METHOD, PARAMETERS)
    print("Making request: {}".format(METHOD))
    pprint(REQUEST.json())
else print("Invalid username or Password!")

Authors

License

This project is licensed under the GNU V3.0 License - see the LICENSE.md file for details