MedatechUK Python API for Priority oData
Project description
Python API
About
A Python package of common EDI functions.
Install
To install this package use:
pip install MedatechUK.APY
Imports
Logging Class
A class to create log files.
from MedatechUK.mLog import mLog
log = mLog()
log.start( os.getcwd(), "DEBUG" )
log.logger.debug("Starting {}".format(__file__))
Config Class
A class for managing oData settings.
from MedatechUK.oDataConfig import Config
c = Config( # Using this configuration
env="wlnd" , # the Priority environment
path=os.getcwd() # the location of the config file
)
Command Line Arguments
A package of command line tools, including parsing the sys.argv function in Python.
progname.exe -arg value -arg2 "value two"
arg.byName(['arg','a']) = "value"
arg.byName(['arg2','a2']) = "value two"
arg.byName(['arg3','a3']) = None
Serial Class
A package for working with serial data.
See also: Serial object methods
from MedatechUK.Serial import SerialBase , SerialT , SerialF
# Load an Order from json file
with open('test.json', 'r') as the_file:
q = order(json=the_file)
# Save to xml
q.toFile('test2.xml', q.toXML, root="root")
APY Class
A class for handling HTTP Request/Response.
See Also: the http transport example
from MedatechUK.apy import Request , Response
def ProcessRequest(request) :
log = mLog()
try:
q = order(**request.data)
q.toPri(
Config(
env=request.environment ,
path=os.getcwd()
) ,
q.toFlatOdata,
request=request
)
except Exception as e:
log.logger.critical(str(e))
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
request.response.Status = 500
request.response.Message = "Internal Server Error"
request.response.data ={ "error" :
{
"type": exc_type,
"message": str(e),
"script": fname,
"line": exc_tb.tb_lineno
}
}
EPDM Class
A package for working with EPDM (Solid Works) serial data.
See Also: Making the EPDM example executable.
See Also: Running the EPDM executable from a service
from MedatechUK.epdm import xmlTransactions
# Load an EPDM file.
try:
with open('example.xml', 'r') as the_file:
q = xmlTransactions(_xml=the_file)
for t in q.transactions:
recurse(t.document)
except Exception as e:
log.logger.critical(str(e))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
MedatechUK.APY-0.0.21.tar.gz
(37.6 kB
view hashes)
Built Distribution
Close
Hashes for MedatechUK.APY-0.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f36659680ce6d193dff098d7f75ab5284508d0c07478197f2c68e6421b35f78 |
|
MD5 | 7a188e7b725789727fb0c95c1c4ef9c7 |
|
BLAKE2b-256 | 726bbde93adf5293032637d888f8d177e2afc1d6374f7882c43020b74c974953 |