Skip to content

Latest commit

 

History

History

ziti-requests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Ziti Requests

This example shows the use of Ziti monkey patching a standard socket, via the requests module, to intercept network connections using a Ziti overlay.

Setup 🔧

Refer to the examples README for details on setting up your network, service, and obtaining an identity file.

Install Python Requirements

If you haven't already installed them, you'll need the dependent libraries used in the examples.

pip install -r ../requirements

Running the Example ▶️

This example accepts one optional input argument.

  1. The intercept address to bind to (if none is provided, the httpbin.ziti service from ZEDs will be assumed)
python ziti-requests.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"

Testing the Example 📋

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.

Example:

After starting up the Flazk example with a service called python.flask.ziti...

export ZITI_IDENTITIES=<path/to/dialer/id.json>
python ziti-requests.py python.flask.ziti

Example Output:

Using a service called python.flask.ziti on port 80 here is what this would look like.

$ python ziti-requests.py python.flask.ziti
{'Content-Length': '49', 'Content-Type': 'text/html; charset=utf-8', 'Date': 'Wed, 12 Apr 2023 18:56:12 GMT', 'Server': 'waitress'}
{'name': 'Ziti', 'message': 'Have some JSON Ziti'}