This example shows using a "zitified" urllib3 module to send a request to a server.
Refer to the examples README for details on setting up your network, service, and obtaining an identity file.
If you haven't already installed them, you'll need the dependent libraries used in the examples.
pip install -r ../requirements
This example accepts one optional input argument.
- The intercept address to bind to (if none is provided, the
httpbin.ziti
service from ZEDs will be assumed)
python ziti-urllib3.py <address-of-service>
This example also requires the identity file for binding to the service to be provided in the ZITI_IDENTITIES
environment variable.
export ZITI_IDENTITIES="/path/to/id.json"
One easy way to test this example is with the Flazk example. Once that server is spun up and ready to handle requests, we can run this example, sending a request to the flask server.
After starting up the Flazk example with a service called python.flask.ziti
...
export ZITI_IDENTITIES=<path/to/dialer/id.json>
python ziti-urllib3.py python.flask.ziti
Using a service called python.flask.ziti
on port 80
here is what this would look like.
$ python ziti-urllib3.py python.flask.ziti
200 OK
Have some Ziti!