title: Cannot invoke ngrok in python
body: <p>I'm running flask in google colaboratory.</p>
  <pre class="lang-py prettyprint-override"><code>import os
  
  html = &quot;&quot;&quot;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot; /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  Hello
  &lt;form action=&quot;{{ url_for('submit') }}&quot; method=&quot;post&quot;&gt;
      &lt;textarea name=&quot;text&quot;&gt;&lt;/textarea&gt;
      &lt;input type=&quot;submit&quot;&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  &quot;&quot;&quot;
  
  with open(&quot;pegasus/bin/evaluate.py&quot;):
    if not os.path.isdir( &quot;templates&quot; ):
        os.makedirs( &quot;templates&quot; )
    with open(&quot;templates/index.html&quot;, mode='w') as f:
        f.write(html)
  
    from flask import Flask, render_template, request
  
    app = Flask(__name__)
  
    @app.route(&quot;/&quot;)
    def index():
        return render_template( &quot;index.html&quot; )
  
    @app.route('/submit', methods=['POST'])
    def submit():
        hello_eval()
        # request.formがユーザーの送信した文字列を保持するようになっている。
        return 'You entered: {}'.format(request.form['text'])
  
    if __name__ == '__main__':
        app.run(port=6006)
  </code></pre>
  <p>This is my flask code, and I want to access <code>index.html</code> in my browser.
  So I pasted a code for getting ngrok's url.</p>
  <pre><code>get_ipython().system_raw('./ngrok http 6006 &amp;')
  !curl -s http://localhost:4040/api/tunnels | python3 -c \
    &quot;import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])&quot;
  </code></pre>
  <p>But the code throws an error.</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/lib/python3.6/json/__init__.py&quot;, line 299, in load
      parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
    File &quot;/usr/lib/python3.6/json/__init__.py&quot;, line 354, in loads
      return _default_decoder.decode(s)
    File &quot;/usr/lib/python3.6/json/decoder.py&quot;, line 339, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File &quot;/usr/lib/python3.6/json/decoder.py&quot;, line 357, in raw_decode
      raise JSONDecodeError(&quot;Expecting value&quot;, s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  </code></pre>
  <p>I remember I ran it properly about 2 weeks ago. What can I do for that?</p>
  <p>Help me!</p>