-
Notifications
You must be signed in to change notification settings - Fork 4
API Doc : Python
Skull do not support Python service, so only module related APIs provided.
Indexes:
- Txn
- TxnData
- Logger
- Http Request/Response
API Module: skullpy.txn
Besides module_init and module_release, all other module_ callbacks will pass the Txn Object there as a parameter. Txn means the Transaction object, which is used for:
- Get/set transaction shared data
- Identify the transaction status
- Communicate with Service
Return the transaction shared data, this data has been converted to the correct type already.
This API return the status in currently, values are:
- TXN_OK: No errors, everything is good.
- TXN_ERROR: Error occurred, so users should prepare to construct error response then.
- TXN_TIMEOUT: Timeout occurred if users configure a
timeout
item inworkflow
.
API Module: skullpy.txndata
TxnData
is a parameter in module_pack
stage, users use it to send the response back to the client.
Append a bytes/string data to the response, which will be send back to client then.
API Module: skullpy.logger
logger.trace(msg)
logger.debug(msg)
logger.info(code, msg)
logger.warn(code, msg, suggestion)
logger.error(code, msg, solution)
logger.fatal(code, msg, solution)
The usage is the same as Cpp language.
API Module: skullpy.http
Since Python is powerful by handle the HTTP stuffs, to better integrate with other web service like Nginx
, Skull provide a http wrapper by using WebOb internally.
Example code can be found here
Construct a http request object with the raw input HTTP content data.
After construct the request object, then call this API to parse it to a WebOb Request object, then users can use it to get the http data very easily.
In case some users want to get the environ
variable which be used for constructing the request object, this API would return that for the purpose.
After users handling all the logic, and want to construct a http response sending back to client, create the http.Response
object, and add the http content, then call this API to get a full string of the http response content. Next, call txndata.append(data)
to send it back.