# Creating a share in Zrok python SDK

**URL:** <https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429>\
**Category:** SDK Questions\
**Created:** [April 13, 2024, 4:33am UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429 "2024-04-13T04:33:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbenachour](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/mbenachour/32/1921_2.png) [@mbenachour](https://openziti.discourse.group/u/mbenachour)\
**Post date:** [April 13, 2024, 4:33am UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429/1 "2024-04-13T04:33:58Z")

</div>

I'm trying to create a share and maintain it open using the python SDK for Zrok, I have a c# http server running on port 8000

```auto
#!python3
import sys
import zrok
from zrok.model import ShareRequest
import atexit

zrok_opts = {}

root = zrok.environment.root.Load()
try:
        shr = zrok.share.CreateShare(root=root, request=ShareRequest(
            BackendMode=zrok.model.TCP_TUNNEL_BACKEND_MODE,
            ShareMode=zrok.model.PUBLIC_SHARE_MODE,
            Frontends=['public'],
            Target="http://localhost:8000"
        ))
        shrToken = shr.Token
        print("Access server at the following endpoints: ", "\n".join(shr.FrontendEndpoints))

except Exception as e:
        print("unable to create share", e)
        sys.exit(1)

input("Press enter to continue...")

```

while this can create a share :

```auto
Access server at the following endpoints: http://kh8l5dcjkdij.zrok.xxxxxx.com
Press enter to continue...

```

the share doesn't seem to be accessible ( says not found )

am I missing something in the SDK code?

---

<div class="post-metadata">

**Author:** ![michael.quigley](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/michael.quigley/32/1123_2.png) [@michael.quigley](https://openziti.discourse.group/u/michael.quigley)\
**Post date:** [April 13, 2024, 4:39am UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429/2 "2024-04-13T04:39:20Z")

</div>

It looks like you're creating the share... but there's no listener?

If you don't actually start a listener, there is nothing to connect to and you'll end up getting a 404.

If you look at the full HTTP example, you'll see there is an HTTP server instantiated... that includes a listener:

> <https://github.com/openziti/zrok/blob/main/sdk/python/examples/http-server/server.py>

If you look at the `copyto` portion of the pastebin example:

> <https://github.com/openziti/zrok/blob/main/sdk/python/examples/pastebin/pastebin.py>

...you'll see that it's directly creating a listener:

```auto
        with zrok.listener.Listener(shr.Token, root) as server:
            while not exit_signal.is_set():
                conn, peer = server.accept()
                with conn:
                    conn.sendall(data.encode('utf-8'))

```

---

<div class="post-metadata">

**Author:** ![mbenachour](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/mbenachour/32/1921_2.png) [@mbenachour](https://openziti.discourse.group/u/mbenachour)\
**Post date:** [April 13, 2024, 5:57am UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429/3 "2024-04-13T05:57:21Z")

</div>

I saw the http\_server example, can we create a share and listener without using waitress/flask ? because my website is a c# app listening on port 8000

---

<div class="post-metadata">

**Author:** ![michael.quigley](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/michael.quigley/32/1123_2.png) [@michael.quigley](https://openziti.discourse.group/u/michael.quigley)\
**Post date:** [April 15, 2024, 4:53pm UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429/4 "2024-04-15T16:53:36Z")

</div>

Yes... there's an example at the bottom of my last post showing a listener in Python without using waitress/flask.

---

<div class="post-metadata">

**Author:** ![michael.quigley](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/michael.quigley/32/1123_2.png) [@michael.quigley](https://openziti.discourse.group/u/michael.quigley)\
**Post date:** [April 15, 2024, 4:55pm UTC](https://openziti.discourse.group/t/creating-a-share-in-zrok-python-sdk/2429/5 "2024-04-15T16:55:34Z")

</div>

If you're looking to just proxy a C# application, you're probably better off using the `zrok share` CLI... the Python SDK does not include a reverse proxy implementation. If you're using the SDK, it's expected that you're embedding it in an application that wants to communicate on the network directly... not proxy to another application.

If you want a proxy in Python, you'll need to build that yourself.
