Пример #1
0
 def _create_web_services(self, name):
     return LadonWSGIApplication(
         service_modules, [join(THIS_DIR, 'services')],
         catalog_name=name,
         catalog_desc=
         'Ladon cannot cover many use cases for Suds, but it is easy to set up and generates WSDLs.'
     )
Пример #2
0
    def run(self):
        os.makedirs(dirname(file_path_log()), exist_ok=True)
        set_logfile(file_path_log())
        set_loglevel(4)  # debug
        set_log_backup_count(50)
        set_log_maxsize(50000)

        scriptdir = dirname(abspath(__file__))
        service_modules = ["select_from_db"]
        import sys

        sys.path.append(scriptdir)

        # Create the WSGI Application
        application = LadonWSGIApplication(
            service_modules,
            [join(scriptdir, "services"),
             join(scriptdir, "appearance")],
            catalog_name="Serwer SOAP integracja systemów",
            catalog_desc="Serwer udostępniający dane zawarte w katalogu.",
            logging=31,
        )
        port = 58585
        server = wsgiref.simple_server.make_server("", port, application)
        server.serve_forever()
Пример #3
0
def get_ladon_application():
    """

    Configure Ladon wsgi application,

    autodiscover ladon modules and paths

    """

    service_modules = []

    paths = []

    for app_config in apps.get_app_configs():

        # add webservices from ladon modules.

        module_name = '{}.ladon'.format(app_config.name)

        module_path = os.path.join(app_config.path, 'ladon.py')

        if os.path.exists(module_path):
            service_modules.append(module_name)

        # add ladon template paths

        template_path = os.path.join(app_config.path, 'templates/ladon')

        if os.path.exists(template_path):
            paths.append(template_path)

        # add ladon css paths

        css_path = os.path.join(app_config.path, 'static/ladon/css')

        if os.path.exists(css_path):
            paths.append(css_path)

    return LadonWSGIApplication(service_modules, paths)
import wsgiref.simple_server
from os.path import normpath, abspath, dirname, join
from ladon.tools.log import set_loglevel, set_logfile, set_log_backup_count, set_log_maxsize
set_logfile(join(dirname(normpath(abspath(__file__))), 'examples.log'))
set_loglevel(4)  # debug
set_log_backup_count(50)
set_log_maxsize(50000)

scriptdir = dirname(abspath(__file__))
service_modules = ['calculator']

# Create the WSGI Application
application = LadonWSGIApplication(
    service_modules,
    [join(scriptdir, 'services'),
     join(scriptdir, 'appearance')],
    catalog_name='Ladon Service Examples',
    catalog_desc=
    'The services in this catalog serve as examples to how Ladon is used',
    logging=31)

if __name__ == '__main__':
    # Starting the server from command-line will create a stand-alone server on port 8080
    port = 8080
    print(
        "\nExample services are running on port %(port)s.\nView browsable API at http://localhost:%(port)s\n"
        % {'port': port})

    server = wsgiref.simple_server.make_server('', port, application)
    server.serve_forever()
Пример #5
0
"""
    Dummy conftest.py for jsonwspclient.

    If you don't know what this is for, just leave it empty.
    Read more about conftest.py under:
    https://pytest.org/latest/plugins.html
"""
from __future__ import print_function, absolute_import, division
from os.path import abspath, dirname, join
import os
import glob
import pytest
from pytest_localserver.http import WSGIServer
from ladon.server.wsgi import LadonWSGIApplication
PATH = dirname(abspath(__file__))
application = LadonWSGIApplication(['transfertest'], [PATH])


@pytest.fixture()
def cleandir():
    for path in glob.iglob(join(PATH, 'upload/*')):
        os.remove(path)
    for path in glob.iglob(join(PATH, 'download/*')):
        os.remove(path)


@pytest.fixture(scope="session")
def testserver():
    """Defines the testserver funcarg"""
    server = WSGIServer(application=application, port=0)
    server.start()
Пример #6
0
# -*- coding: utf-8 -*-
# Copyright 2019 AVATech
#
# Author Harold.Duan
# This module is python's wsgi function adapted to Apache soap server

from ladon.server.wsgi import LadonWSGIApplication

application = LadonWSGIApplication(['soap'], ['./apps/soap.py'])
Пример #7
0
def make_server():
	global service_modules
	application = LadonWSGIApplication(service_modules,[os.path.join(os.path.dirname(__file__),'services')])
	server = wsgiref.simple_server.make_server('', 2376, application)
	return server
Пример #8
0
from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath, dirname

application = LadonWSGIApplication(
    ['mypa_rr_api'], [dirname(abspath(__file__))],
    catalog_name='MyPA service catalogue',
    catalog_desc='This is the API service catalogue for MyPA')
Пример #9
0
from ladon.tools.log import set_loglevel, set_logfile, set_log_backup_count, set_log_maxsize
from apps import soap

set_logfile(join(dirname(normpath(abspath(__file__))), 'examples.log'))
set_loglevel(4)  # debug
set_log_backup_count(50)
set_log_maxsize(50000)

scriptdir = dirname(abspath(__file__))
# scriptdir = join(scriptdir,'apps')
service_modules = ['soap']
service_paths = [join(scriptdir, 'apps')]

# Create the WSGI Application
application = LadonWSGIApplication(
    service_modules,
    service_paths,
    catalog_name='Ladon Service Examples',
    catalog_desc=
    'The services in this catalog serve as examples to how Ladon is used',
    logging=31)

if __name__ == '__main__':
    # Starting the server from command-line will create a stand-alone server on port 8080
    port = 7095
    print(
        "\nExample services are running on port %(port)s.\nView browsable API at http://localhost:%(port)s\n"
        % {'port': port})

    server = wsgiref.simple_server.make_server('', port, application)
    server.serve_forever()
Пример #10
0
from ladon.server.wsgi import LadonWSGIApplication
print('starting handler')
app = LadonWSGIApplication(['soapservice'], ['soapservice.py'])
Пример #11
0
    set_log_backup_count,
    set_log_maxsize,
)

set_logfile(join(dirname(normpath(abspath(__file__))), "examples.log"))
set_loglevel(4)  # debug
set_log_backup_count(50)
set_log_maxsize(50000)

scriptdir = dirname(abspath(__file__))
service_modules = ["select_from_db"]

# Create the WSGI Application
application = LadonWSGIApplication(
    service_modules,
    [join(scriptdir, "services"),
     join(scriptdir, "appearance")],
    catalog_name="Serwer SOAP integracja systemów",
    catalog_desc="Serwer udostępniający dane zawarte w katalogu.",
    logging=31,
)

if __name__ == "__main__":
    # Starting the server from command-line will create a stand-alone server on port 58585
    port = 58585
    print(
        f"\nIS services are running on port {port}.\nView browsable API at http://localhost:{port}\n"
    )
    server = wsgiref.simple_server.make_server("", port, application)
    server.serve_forever()
Пример #12
0
# -*- coding: utf-8 -*-

from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath, dirname
import inject

inject.configure()

application = LadonWSGIApplication(['SilegWS'],
  [dirname(abspath(__file__))],
  catalog_name='Catalogo del webservice del sileg',
  catalog_desc='Raiz del catálogo del webservice del sileg')