Christian,
maybe you want your local Python client to directly interact with the datastore used by the server app?
I haven't looked into App Inventor, but from your server source code sample I assume, that the server is running in Google App Engine (Python). It is able to handle requests from either a client app on a smartphone (by using JSON) or from a Web-browser (rendering and returning an HTML page). The sample also shows that data is stored in Google Cloud Datastore. For doing this inside a server app on GAE (Python), you have two libraries available to access the Datastore API easily and directly from the GAE app: the old `db` library (as in your sample), or the new `ndb` library. I don't think you can use these libs outside of GAE.
If you want to implement a local Python client in this setup you can pick between two approaches:
(1) Access the server app like your mobile app through some kind of HTTP REST API. Advantage: business logic built into your server app is always applied and the server can safeguard your data in many ways - whatever client and user is interacting with the server app. Consider the potential risk that a client is malicious or its code has been modified. Disadvantage: this approach might require some more efforts in designing the different layers (i.e. separation of concerns).
(2) Directly access the data, with no server that would impose safeguard measures. In this case, your local Python client does not interact with the web-app on GAE, but directly with Google Cloud Datastore API. Advantage: you can build a query directly into the local Python client, no need to modify the server app. Disadvantage: if you allow the Python client to write directly to the datastore, you can mess up the data in many ways (especially if the client is not an internal tool of yours, but also used by many other users).
So, if you want a local Python client as internal admin tool, preferably read-only datastore access, you should be fine with the second approach. In that case, the Cloud Datastore client library for Python is your choice. For everything else, I recommend the first approach, so your Python client interacts with the server, just as your mobile app does. In this case, you need to learn how your Python client can send HTTP requests to your server app and how to process the response. And of course you would need to learn how to implement any missing API / feature on your server app.
I hope this was helpful for you.
Anastasios