Closed jimkring closed 5 months ago
Sure, the label options can be set on the listener using builder configuration. Taking some bits from the ngrok-labeled.py example, that would look something like this in that djangosite example, replacing the ngrok.default()
convenience function:
session = await ngrok.SessionBuilder().authtoken_from_env().connect()
listener = await session.labeled_listener().label("edge", "edghts_<edge_id>").listen()
print(f"Forwarding to {listen} from ingress id: {listener.id()}")
The label(label, value)
can be called multiple times to add more label pairs. Hopefully that will work for your use case! Thank you for the feedback around working with Edges.
Hi there, hopefully that example was helpful in getting the labeled tunnels to work in Django, going to close out this ticket, feel free to reopen if there are any other questions or issues. Thanks for writing in!
I found a stub/placeholder document for using ngrok with django and also found a django example here in the sources.
However, I couldn't figure out how/where to add
labels='edge:edge_yadayada...'
into the configuration for the listener.Neither the
ngrok.default()
nor thelistener.forward()
methods (shown below, in a snippet from the django example) support alabels
argument. Where would these various parameters be passed, which are generally designed to be passed tongrok.forward()
?Thanks,