Extend pyswagger¶
This section describes things about extending pyswagger.
A new client implementation¶
To implement a customized client, you need to aware BaseClient
-
class
pyswagger.core.
BaseClient
(security=None)[source]¶ base implementation of SwaggerClient, below is an minimum example to extend this class
class MyClient(BaseClient): # declare supported schemes here __schemes__ = ['http', 'https'] def request(self, req_and_resp, opt): # passing to parent for default patching behavior, # applying authorizations, ...etc. req, resp = super(MyClient, self).request(req_and_resp, opt) # perform request by req ... # apply result to resp resp.apply(header=header, raw=data_received, status=code) return resp
-
__weakref__
¶ list of weak references to the object (if defined)
-
prepare_schemes
(req)[source]¶ make sure this client support schemes required by current request
Parameters: req (pyswagger.io.Request) – current request object
-