openziti


Nameopenziti JSON
Version 0.8.1 PyPI version JSON
download
home_pagehttps://github.com/openziti/ziti-sdk-py
SummaryZiti Python SDK
upload_time2023-10-10 19:43:31
maintainer
docs_urlNone
authorOpenZiti Developers
requires_python
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a href="https://docs.openziti.io/">
    <img src="./images/ziti-logo-dark.svg" alt="ziti logo" title="OpenZiti" align="right" height="60" />
</a>

# Python SDK for OpenZiti
<p align="center">
  <a href="https://openziti.discourse.group/">
    <img src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fopenziti.discourse.group" alt="Discourse">
  </a>
  <a href="https://github.com/openziti/ziti-sdk-py">
    <img src="https://img.shields.io/github/stars/openziti/ziti-sdk-py" alt="GitHub Stars"
  </a>
  <a href="https://pypi.org/project/openziti/">
    <img src="https://img.shields.io/pypi/dd/openziti" alt="Downloads">
  </a>
  <a href="https://opensource.org/licenses/Apache-2.0">
    <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
  </a>
</p>

<p align="center">
  <a href="#getting-started">Getting Started</a> •
  <a href="#examples">Examples</a> •
  <a href="#support">Support</a> •
  <a href="#contributing">Contributing</a> •
  <a href="#license">License</a>
</p>

<img src="./images/Ziggy-Loves-Python.svg" align="right" alt="ziggy-loves-python" width="15%">

The Python SDK for [OpenZiti](https://github.com/openziti/ziti) is a library that enables you to integrate zero trust network connectivity into your Python 
applications, and establish secure connections with remote network resources over an OpenZiti network. The SDK also 
simplifies the process of adding secure, zero-trust network connectivity built into your Python application. It's so 
simple that it can be done in just two lines of code!

OpenZiti is an open-source project that provides secure, zero-trust networking for applications running on any platform.

More specifically, the SDK allows you to integrate zero trust at the application level. This means your data is never 
exposed outside the application environment providing you with end-to-end encryption for ultimate security. See other 
zero trust models [here](https://docs.openziti.io/docs/learn/core-concepts/zero-trust-models/overview).
<p align="center">
<img src="./images/ztaa-model-overview.png" alt="Zero-trust-application-access">
</p>

## Getting Started
If you don't already have an OpenZiti network running, you can follow our [express install guides](https://docs.openziti.io/docs/learn/quickstarts/network/) 
to set up the network that fits your needs. Or, you can try [CloudZiti](https://netfoundry.io/pricing/) for free, check out more [here](https://docs.openziti.io/).

### Installing the SDK

The Python SDK for OpenZiti is distributed via the Python Package Index (PyPI) and can be installed using 
[`pip`](https://pypi.org/project/openziti/) package manager.

```shell
pip install openziti
```

### Using Ziti Python SDK
With just two lines of code, you can turn your plain old web server into a secure, zero-trust embedded application. 
Below is an example of just how simple it is to get started.

Provide a hostname, and port for your application, a simple monkey patch, and you're ready to go. You don't even need to 
know what a monkey patch is! However, if you're interested in what a monkey patch is, expand the block below.
<details>
   <summary>What is Monkey Patching?</summary>

   > Monkey patching allows developers to modify functionality for code even when they may not have access to the 
   > original source code. Because Python has a dynamic object model allowing developers to modify objects at runtime. 
   > Monkey patching allows developers to point a function call to any function they want. We can even implement our 
   > own function that doesn't exist in the source code.
   > 
   > The way this Python SDK uses monkey patching is to override existing functionality in socket handling by the 
   > [socket module](https://docs.python.org/3/library/socket.html).
   > 
   > Taking a look at the code below, the key lines are the last two. You can see how, for each monkey patched function, 
   > we're telling that function call on the `sock` object to be directed to the function held in `_patch_methods`. 
   > Therefore, this SDK can be used on any application that doesn't manage its own sockets.
   > ```python
   > def __init__(self, **kwargs):
   >     self.orig_socket = sock.socket
   >     sock.socket = _patchedSocket(kwargs)
   >     self.orig_methods = {m: sock.__dict__[m] for m, _ in
   >                          _patch_methods.items()}
   >     for m_name, _ in _patch_methods.items():
   >         sock.__dict__[m_name] = _patch_methods[m_name]
   > ```

   </details>

```python
cfg = dict(ztx=openziti.load('/path/to/identity.json'), service="name-of-ziti-service")
openziti.monkeypatch(bindings={('127.0.0.1', 8000): cfg})
```
Or try our decorator pattern with a function annotation
```python
@openziti.zitify(bindings={('127.0.0.1', 18080): {'ztx': '/path/to/identity.json', 'service': 'name-of-ziti-service'}})
def yourFunction():
```

The `binding` dictionary configures what happens when the code tries to open a server socket. Standard network addresses 
are mapped to ziti service configurations. For example, with his configuration
```python
bindings = {
   ('0.0.0.0', 8080): { 'ztx': 'my-identity.json', 'service':'my-service' }
}
```
when application opens a server socket and binds to address `0.0.0.0:8080` it will actually bind to the ziti service named `my-service`.

Binding addresses can be specified with tuples, strings, or ints(ports). `('0.0.0.0', 8080)`, `'0.0.0.0:8080'`, `':8080'`, `8080` 
are all considered and treated the same.

## Examples
Try it out yourself with one of our [examples](sample%2FREADME.md)
* [Flazk](sample/flask-of-ziti)
* [Echo Server](sample/ziti-echo-server)
* [HTTP Server](sample/ziti-http-server)
* [Ziti Requests](sample/ziti-requests)
* [Ziti Socket](sample/ziti-socket)
* [Ziti urllib3](sample/ziti-urllib3)

## Support
### Looking for Help?
Please use these community resources for getting help. We use GitHub [issues](https://github.com/openziti/ziti-sdk-py/issues)
for tracking bugs and feature requests and have limited bandwidth to address them.

- Read the [offical docs](https://docs.openziti.io/docs/learn/introduction/)
- Join our [Developer Community](https://openziti.org)
- Participate in discussion on [Discourse](https://openziti.discourse.group/)
## Contributing
Do you want to get your hands dirty and help make OpenZiti better? Contribute to the OpenZiti open-source project 
through bug reports, bug fixes, documentation, etc. Check out our guide on contributing to our projects [here](https://docs.openziti.io/policies/CONTRIBUTING.html).
## License
[Apache 2.0](./LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/openziti/ziti-sdk-py",
    "name": "openziti",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "OpenZiti Developers",
    "author_email": "developers@openziti.org",
    "download_url": "https://files.pythonhosted.org/packages/20/51/656373a609514234cf4c510d5eb8ecaf5c778466129109e6bb92573dd4ce/openziti-0.8.1.tar.gz",
    "platform": null,
    "description": "<a href=\"https://docs.openziti.io/\">\n    <img src=\"./images/ziti-logo-dark.svg\" alt=\"ziti logo\" title=\"OpenZiti\" align=\"right\" height=\"60\" />\n</a>\n\n# Python SDK for OpenZiti\n<p align=\"center\">\n  <a href=\"https://openziti.discourse.group/\">\n    <img src=\"https://img.shields.io/discourse/users?server=https%3A%2F%2Fopenziti.discourse.group\" alt=\"Discourse\">\n  </a>\n  <a href=\"https://github.com/openziti/ziti-sdk-py\">\n    <img src=\"https://img.shields.io/github/stars/openziti/ziti-sdk-py\" alt=\"GitHub Stars\"\n  </a>\n  <a href=\"https://pypi.org/project/openziti/\">\n    <img src=\"https://img.shields.io/pypi/dd/openziti\" alt=\"Downloads\">\n  </a>\n  <a href=\"https://opensource.org/licenses/Apache-2.0\">\n    <img src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\">\n  </a>\n</p>\n\n<p align=\"center\">\n  <a href=\"#getting-started\">Getting Started</a> \u2022\n  <a href=\"#examples\">Examples</a> \u2022\n  <a href=\"#support\">Support</a> \u2022\n  <a href=\"#contributing\">Contributing</a> \u2022\n  <a href=\"#license\">License</a>\n</p>\n\n<img src=\"./images/Ziggy-Loves-Python.svg\" align=\"right\" alt=\"ziggy-loves-python\" width=\"15%\">\n\nThe Python SDK for [OpenZiti](https://github.com/openziti/ziti) is a library that enables you to integrate zero trust network connectivity into your Python \napplications, and establish secure connections with remote network resources over an OpenZiti network. The SDK also \nsimplifies the process of adding secure, zero-trust network connectivity built into your Python application. It's so \nsimple that it can be done in just two lines of code!\n\nOpenZiti is an open-source project that provides secure, zero-trust networking for applications running on any platform.\n\nMore specifically, the SDK allows you to integrate zero trust at the application level. This means your data is never \nexposed outside the application environment providing you with end-to-end encryption for ultimate security. See other \nzero trust models [here](https://docs.openziti.io/docs/learn/core-concepts/zero-trust-models/overview).\n<p align=\"center\">\n<img src=\"./images/ztaa-model-overview.png\" alt=\"Zero-trust-application-access\">\n</p>\n\n## Getting Started\nIf you don't already have an OpenZiti network running, you can follow our [express install guides](https://docs.openziti.io/docs/learn/quickstarts/network/) \nto set up the network that fits your needs. Or, you can try [CloudZiti](https://netfoundry.io/pricing/) for free, check out more [here](https://docs.openziti.io/).\n\n### Installing the SDK\n\nThe Python SDK for OpenZiti is distributed via the Python Package Index (PyPI) and can be installed using \n[`pip`](https://pypi.org/project/openziti/) package manager.\n\n```shell\npip install openziti\n```\n\n### Using Ziti Python SDK\nWith just two lines of code, you can turn your plain old web server into a secure, zero-trust embedded application. \nBelow is an example of just how simple it is to get started.\n\nProvide a hostname, and port for your application, a simple monkey patch, and you're ready to go. You don't even need to \nknow what a monkey patch is! However, if you're interested in what a monkey patch is, expand the block below.\n<details>\n   <summary>What is Monkey Patching?</summary>\n\n   > Monkey patching allows developers to modify functionality for code even when they may not have access to the \n   > original source code. Because Python has a dynamic object model allowing developers to modify objects at runtime. \n   > Monkey patching allows developers to point a function call to any function they want. We can even implement our \n   > own function that doesn't exist in the source code.\n   > \n   > The way this Python SDK uses monkey patching is to override existing functionality in socket handling by the \n   > [socket module](https://docs.python.org/3/library/socket.html).\n   > \n   > Taking a look at the code below, the key lines are the last two. You can see how, for each monkey patched function, \n   > we're telling that function call on the `sock` object to be directed to the function held in `_patch_methods`. \n   > Therefore, this SDK can be used on any application that doesn't manage its own sockets.\n   > ```python\n   > def __init__(self, **kwargs):\n   >     self.orig_socket = sock.socket\n   >     sock.socket = _patchedSocket(kwargs)\n   >     self.orig_methods = {m: sock.__dict__[m] for m, _ in\n   >                          _patch_methods.items()}\n   >     for m_name, _ in _patch_methods.items():\n   >         sock.__dict__[m_name] = _patch_methods[m_name]\n   > ```\n\n   </details>\n\n```python\ncfg = dict(ztx=openziti.load('/path/to/identity.json'), service=\"name-of-ziti-service\")\nopenziti.monkeypatch(bindings={('127.0.0.1', 8000): cfg})\n```\nOr try our decorator pattern with a function annotation\n```python\n@openziti.zitify(bindings={('127.0.0.1', 18080): {'ztx': '/path/to/identity.json', 'service': 'name-of-ziti-service'}})\ndef yourFunction():\n```\n\nThe `binding` dictionary configures what happens when the code tries to open a server socket. Standard network addresses \nare mapped to ziti service configurations. For example, with his configuration\n```python\nbindings = {\n   ('0.0.0.0', 8080): { 'ztx': 'my-identity.json', 'service':'my-service' }\n}\n```\nwhen application opens a server socket and binds to address `0.0.0.0:8080` it will actually bind to the ziti service named `my-service`.\n\nBinding addresses can be specified with tuples, strings, or ints(ports). `('0.0.0.0', 8080)`, `'0.0.0.0:8080'`, `':8080'`, `8080` \nare all considered and treated the same.\n\n## Examples\nTry it out yourself with one of our [examples](sample%2FREADME.md)\n* [Flazk](sample/flask-of-ziti)\n* [Echo Server](sample/ziti-echo-server)\n* [HTTP Server](sample/ziti-http-server)\n* [Ziti Requests](sample/ziti-requests)\n* [Ziti Socket](sample/ziti-socket)\n* [Ziti urllib3](sample/ziti-urllib3)\n\n## Support\n### Looking for Help?\nPlease use these community resources for getting help. We use GitHub [issues](https://github.com/openziti/ziti-sdk-py/issues)\nfor tracking bugs and feature requests and have limited bandwidth to address them.\n\n- Read the [offical docs](https://docs.openziti.io/docs/learn/introduction/)\n- Join our [Developer Community](https://openziti.org)\n- Participate in discussion on [Discourse](https://openziti.discourse.group/)\n## Contributing\nDo you want to get your hands dirty and help make OpenZiti better? Contribute to the OpenZiti open-source project \nthrough bug reports, bug fixes, documentation, etc. Check out our guide on contributing to our projects [here](https://docs.openziti.io/policies/CONTRIBUTING.html).\n## License\n[Apache 2.0](./LICENSE)\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Ziti Python SDK",
    "version": "0.8.1",
    "project_urls": {
        "Discussion": "https://openziti.discourse.group/",
        "Documentation": "https://openziti.github.io/ziti/overview.html",
        "Homepage": "https://github.com/openziti/ziti-sdk-py",
        "Source": "https://github.com/openziti/ziti-sdk-py",
        "Tracker": "https://github.com/openziti/ziti-sdk-py/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2051656373a609514234cf4c510d5eb8ecaf5c778466129109e6bb92573dd4ce",
                "md5": "440b4fbd06f2bcab588d012887ed9c2b",
                "sha256": "5f71a40af17f5cd848feb74f614dbfcf7cb7f9bbc531637c4c1cac09b6d8516d"
            },
            "downloads": -1,
            "filename": "openziti-0.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "440b4fbd06f2bcab588d012887ed9c2b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34976,
            "upload_time": "2023-10-10T19:43:31",
            "upload_time_iso_8601": "2023-10-10T19:43:31.176909Z",
            "url": "https://files.pythonhosted.org/packages/20/51/656373a609514234cf4c510d5eb8ecaf5c778466129109e6bb92573dd4ce/openziti-0.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-10 19:43:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "openziti",
    "github_project": "ziti-sdk-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "openziti"
}
        
Elapsed time: 0.47702s