Reputation: 579
I am trying to run ngrok
with options
I tried
from pyngrok import ngrok
ngrokPublicUrl = ngrok.connect(5000, bind_tls= True)
and
ngrokPublicUrl = ngrok.connect(remote_addr=5000, bind_tls= True)
For options I used the documentation here --> https://ngrok.com/docs#tunnel-definitions. I am trying to get the https address not http. It looks like options
usage is not correct?
but I get this error
TypeError: connect() got an unexpected keyword argument 'remote_addr'
or
TypeError: connect() got an unexpected keyword argument 'bind_tls'
Upvotes: 1
Views: 1870
Reputation: 1293
With pyngrok>=5
, options
have been unpacked to kwargs
, meaning the question asker's original syntax will now work just fine, though it should also be noted with this update that connect()
now returns a NgrokTunnel
instead of the public_url
as a str
like it used to.
pyngrok<=4.1
)I am the developer of pyngrok
. The correct Python snippet was given in the comment above, I'll post it here as well so it can be marked as an answered.
You cannot pass this parameter directly to the connect()
, as you are trying to do, you need to pass it as an options
dictionary to connect() (which will be unpacked to the tunnel definitions in the documentation you've linked—see the API docs here).
from pyngrok import ngrok
options = {
"remote_addr": 5000,
"bind_tls": True
}
ngrokPublicUrl = ngrok.connect(options=options)
Perhaps options
would more intuitively be unpacked in connect()
as kwargs
? I'll take note of that to consider as a future improvement, but for now you need to do it the way described above.
Upvotes: 0