This repository contains a Python Client for playing with WSO2 API Manager REST API and a dummy HTTP(s) and WebSocket server for handling/monitoring requests
I wrote this simple python client to make it easy to create , delete , update lifecycle states of an API for testing purposes.
Start WSO2 API Manager server. You can get the swagger definitions for store and publisher REST APIs in following locations.
- Store : https://localhost:9443/api/am/store/v1.0/apis/swagger.json
- Publisher : https://localhost:9443/api/am/publisher/v1.0/apis/swagger.json
You need to change the API version
, hostname
and port
accordingly.
- Delete existing APIs
- Delete existing Endpoints
- Create new APIs
- Create new Global endpoints
- Publish newly created APIs
- Create new Store Application
- Delete all existing users (Except admin)
- Create new users
How to start the simple HTTP server
python3 simple_endpoint.py
- Support Digest Auth
- Send a request with
digestme
word in anywhere in the request path
- Send a request with
- Basic Auth header decode
- CORS request handler
- Dump payload in
POST
,PUT
orPATCH
requests - Dump all the headers and return them as JSON in response body
- Delay (mimic backend latency) response by setting the
kdelay
(seconds) query parameter in the request i:e http://localhost:8000/apis?kdelay=2.5 - Response with supported content types (
application/xml
orapplication/json
). Honor theaccept
header if present - Return sample file when requested with available sample files extensions in
mock_servers/resources/
directory- Example: localhost:8000/apis/send/me/a.pdf will return python.pdf file in
mock_servers/resources/
with content-type header asapplication/pdf
- If want to add support to new extension, put the file to
mock_servers/resources/
i:emy_sample.extension
and make a request like localhost:8000/apis/send/my/sample.extension , It will return themy_sample.extension
file withapplication/{extension}
in thecontent-type
header
- Example: localhost:8000/apis/send/me/a.pdf will return python.pdf file in
How to start the simple HTTP endpoint server
python3 simple_websocket.py
Simple service to monitor WS initialization flow
- See the initial handshake HTTP request
- Dump websocket frame content
- Reply to WS message