Hello Anastasios, I thank you very much for this detailed answer. I think the N° 1 solution is the one I will use. I do not want any database or service modification it's why I'd like build a local Python App taking exactly the same mechanism than the Androïd app to access the datas...
Thank you again. Have good Sunday. Best regards, Christian. Le dimanche 30 octobre 2016 01:01:39 UTC+2, Anastasios Hatzis a écrit : > > Christian, > > maybe you want your local Python client to directly interact with the > datastore used by the server app? > In this case, you would need the Cloud Datastore client library for Python > <https://cloud.google.com/datastore/docs/reference/libraries#client_libraries_install_python> > (and > Tutorial <https://cloud.google.com/datastore/docs/datastore-api-tutorial> > here). However, I would like to take a few aspects into consideration > (since I don't know what you actually want to achieve). > > 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 > > > Am Samstag, 29. Oktober 2016 18:51:33 UTC+2 schrieb Christian Feniou: >> >> Bonsoir George, >> >> Unfortunately, there is not the answer I'm looking for in these links ! >> There are many documents and examples to build and deploy a server >> application but the sample I search is a "client" python application. >> >> In the server source code it's a difference between access from Web or >> access from application : >> >> def WriteToPhone(handler,tag,value): >> >> handler.response.headers['Content-Type'] = 'application/jsonrequest' >> json.dump(["VALUE", tag, value], handler.response.out) >> >> def WriteToWeb(handler, tag,value): >> entries = db.GqlQuery("SELECT * FROM StoredData ORDER BY date desc") >> template_values={"result": value,"entryList":entries} >> path = os.path.join(os.path.dirname(__file__),'index.html') >> handler.response.out.write(template.render(path,template_values)) >> >> My main problem is how to pass the "questions" with the right parameters >> from the local python application to the server... >> >> I seen a module named "google.appengine.api.datastore" looking as the >> module I need... But I don't know how to implement it. >> >> Thanks a lot... >> >> >> >> Le samedi 29 octobre 2016 09:55:34 UTC+2, Christian Feniou a écrit : >>> >>> Hello George, >>> >>> Thank you so much for your answer. I'll have a look on the addresses you >>> gave me. I hope I'll found the call back example I'm looking for !! >>> I'll inform you soon for the result of these "investigations"... >>> >>> Sorry for my low quality English language but, as you certainly >>> understand I'm French... >>> >>> Have a good weekend, >>> >>> Best regards >>> >>> >>> Le vendredi 28 octobre 2016 23:25:23 UTC+2, George (Cloud Platform >>> Support) a écrit : >>>> >>>> Hello Christian, >>>> >>>> Thank you for posting your issue here! >>>> >>> >>> >>> >>>> >>>> App Engine applications are meant to be accessed from a browser. The >>>> app itself might be written in Python. You can find such an example >>>> here >>>> <https://cloud.google.com/appengine/docs/python/getting-started/creating-guestbook>. >>>> >>>> >>>> >>>> If you want to access your data, such that contained in form fields on >>>> a web page, from a python program running on a PC, you may put to good use >>>> some of the many examples and tutorials on the web >>>> <https://pythonschool.net/server-side-scripting/processing-the-form-data/>. >>>> >>>> >>>> >>>> Let us know if this addresses your concerns, and if you need more >>>> information on the App Engine. >>>> >>>> I hope this helps. Cheers! >>>> >>> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/40dd4610-2f56-4004-b75b-9f119a88cdcb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
