linkyndy
linkyndy

Reputation: 17928

Python request from Android

I am currently developing an Android app that has some of its back-end features implemented in Python. I am looking for a way to integrate both these parts.

Ideally, the Python script should reside on some sort of server so that the Android app can make requests to it. The Python script uses an SQLite database that needs to be accessed by whoever uses the Android app (that's why the script needs to be on some server).

It would also be great for the beginning if the Python script was held on my local server and ran locally from the Android app (somehow).

My question is: how can I bind these two parts together? What should I opt for? What's the best solution for what I need? Thank you!

Upvotes: 1

Views: 2627

Answers (3)

nglinh
nglinh

Reputation: 611

My company is doing the same thing here. We have 1 backend where 3 clients: ios, android and web points to The way we do is to use Flask and expose api end points, something like

@app.route("/api/dosomething/")
def randomfunction:

Then clients will make http requests to

https://dev.yourapp.com/api/dosomething/

Flask is easier to expose the REST end points.

Upvotes: 1

linkyndy
linkyndy

Reputation: 17928

I've ran upon Flask which is exactly what I needed. It is much easier to implement than what @pypal suggested above.

Upvotes: 0

pypat
pypat

Reputation: 1116

So basically you want a python backend that you're app can access. Sounds to me like a webservice of somesort would be a good idea.

You can see what options there in Python to create a webservice here: http://wiki.python.org/moin/WebServices

Upvotes: 1

Related Questions