Global connection to 3rd party api Flask
<p>I have a Flask app running on Heroku that connects to the Google Maps API during a request.  Something like this:</p>

<pre><code>client = geocoders.GoogleV3(
            client_id=self.config['GM_CLIENT_ID'],
            secret_key=self.config['GM_SECRET_KEY']
        )
client.do_geocoding(...)
</code></pre>

<p>Right now I am creating a new client for every request.  How can I have one connection that persists across multiple requests?</p>

<p>Turns out it's as simple as storing the client instance in a global variable.</p>

python flask