Is there any way to make mobile a server - python

Hi I have a flask server written in python. I need it to be deployed to a mobile device.The reason for it is that I need the requests to be sent from the client. For that I need the flask app to run natively on the device of the client. I also can't write the requests from the client as I am dealing with httpOnly cookies that can't be seen in the js. I am writing the UI in react native, and I was wondering if there is any solution to my problem? Maybe my react native app will prompt the user to install the apk of the flask server on his device and then the client side will connect to that running server on his device?

Related

Running api on ESP32 with micropython

I am making my home smart using esp32 and micropython. I have a Django project running on a server I have on my LAN and I want to send commands to my esp32 wirelessly through it. Maybe something like running a uvicorn server and a fastapi app and then sending messages to the uvicorn server endpoints and I have no idea how to do this.
You should probably use either Django Channels or django-websocket
But I'm not sure if websockets package is ported for micropython, so you might need to use plain socket
Or try something completely different. Physically connect the server and esp32 together (I have absolutely no idea about it)
My recommendation is the first option

Twilio Flask app video call is not connecting over a public IP address

I created an application in Flask Python with a frontend in HTML and Twilio SDK JavaScript version 2.3.0.
A video call is working on local host, but if I try the same app over HTTPS with a valid certificate, it is fetching the token correctly for the video call, but it can't establish a connection to Twilio.
I have tried forcing the browser permissions for the camera and audio to allow and it did not make a difference.
So to load the Twilio script, you need to enable https in both the website and the script. Otherwise, it will mix up HTTP and HTTPS and fail. So there are two simple things to do:
put your website over HTTPS
load the https://media.twiliocdn.com/sdk/js/video/releases/2.3.0/twilio-video.min.js file over HTTPS in file index.html.
This will solve your problem.

Unable to access Flask app hosted on EC2 after adding https support

I have a Flask application currently using http being hosted on an ec2 instance. I want to host my application using https. Currently with http, I am able to access my application (running on 0.0.0.0 port 80) by just accessing the ec2 public IP address (displays Running on http://0.0.0.0:80/, and I am able to use my app at http://IP).
I am following this tutorial to test https support: https://blog.miguelgrinberg.com/post/running-your-flask-application-over-https.
When I add the most basic app.run(ssl_context='adhoc') to my program, the app is now Running on https://0.0.0.0:80/, but I am unable to access my app at https://IP. I opened up my port 403 in my EC2 settings however I am still unable to communicate with my app using https...no response whenever I make a request.
The same no response occurs when I run the application with gunicorn. Am I missing something? I think my requests are well formed, however I am never able to communicate with my app when using https.
Simple way is put your instance behind ALB. ALB is not only load balancer, but also integrate ACM for free.

Python web server with a socketio server

I am looking for a web server that has a socket.io server.I want a small server like cherrypy that come with a socket server so that i wont have to modify a lot of things in an existing web server to make the socket server work.
Is there such a web server?.
So you're looking for Websocket support? Gevent with https://bitbucket.org/Jeffrey/gevent-socketio has worked for my purposes.

Websockets for client/server communication in chrome packaged app

I have thoroughly looked at the Chrome packaged app website and sample apps but I couldn't find any example related to websockets implementation in an app. I was wondering if there is any example or sample app that uses Websocket for client/server communication in Chrome app? If not then is there any guide? Is it even possible to use WebSocket? I am using Apache HTTP as my server which is in Python.
I'm assuming you're asking about implementing a WebSocket server, because the browser natively supports the client. (Though if you wanted, you could definitely implement the WebSocket client because you have access to the raw TCP interface.)
The Chrome Apps has published a sample WebSocket chat server that servers HTTP requests to load the chat client and uses WebSockets to send messages between clients.
If you look through the implementation, you see it uses the older chrome.socket API to listen to a TCP socket and respond with the correct WebSocket HTTP headers. It does all the bit manipulation to send and receive frames of data as required by the WebSocket spec.

Categories