Hi all thanks for help (in advance)
I developed an HTML form, which takes source and destination from the user and uses python in background to combine those files. I hosted this in my web server but if a user is entering the path which is in his desktop my application is not reading. It is searching for the path in the webserver but not in the user desktop.
You need to provide a way for the client to send the file to the server. The app is running on your web server which has its own file system. This server will not have direct access to clients' file system (this would be a huge security concern).
Sounds like you are trying to develop this as if it is a local app on the client's machine. This is not the case because you deployed part of the app to your web server. Think of your app as two pieces. Server side application / client side application. You need to create a way for these two to communicate with each other in a secure manner.
What you are looking for can be done with a REST endpoint on the server side where a client can send the file to the server via a POST request.
Basically the client side of the app (your webpage) could prompt the client to select a file on their machine and then send the contents of the file(s) via HTTP POST to the server side of your app where your python code performs whatever operations you want. The server app could even send a response back to client (the combined files maybe).
Something like this is what you ultimately need to do... note that in this link they developed BOTH server/client parts of their app in python. In your case you have created a webpage client frontend that will run in a browser. You would need to add some code to your webpage to have the user upload a file from their machine and send it to the server.
Sending files between client - server through TCP socket in python?
Related
Im making a webserver from scratch in python by simply supplying HTML content through a tcp socket. I want to be able to run gwt projects, is this possible by just echoing the contents of the generated index.html to a browser?
If it is a client-side GWT application, then yes, you could serve it with a basic HTTP webserver that receives HTTP GET requests from a browser and serves files like HTML, JavaScript, images, etc.
If the GWT application includes server-side servlets then it wouldn't work when the client sent requests to the server part of the application.
Currently I am working on a Schoolproject and I need to send a Notification to a self written Xamarin Forms App from my API. It all runs on a local network and the App can already communicate with the Api, now i want my api to send a notification to my phone if a specific event turns true. How do I do this? (Oh and I am using Python flask for my API, if u need this Information)
Use Push notification for it. As soon as there is a need to call
mobile app from web server send a push notification. Handle the push
notification on application side to make a call to web api as soon as
it receives the push notification with specific payload.
Use Web Sockets if server events are too frequent.
I wrote an app with Android Studio and want to send the data that the user enters to my back-end Python script. This should constantly process the received data and send back the evaluation.
Does anyone have an idea how this could work?
thanks in advance
WebSocket should be the interface of choice.
The python script should expose a WebSocket end point . The mobile app can establish a connection to the WebSocket. The socket can act as a bidirectional channel where the app can send and receive data and the python script can do the same.
Firebase : The app could publish the user inputs to a Firebase topic which the python script listens to. The script can process the inputs and publish to the same channel that the app would listen to. More like a P2P chat
From Backend Python: Create 2 web services (GET or POST depending on the requirements). One is to receive the data from Mobile app and other is to send the data to mobile app.
From Android App: You can use Retrofit or volley library for networking and then consume these web services. Use the web service and send the data(Payload) to the backend and also you can use polling to get the data back to the app.
I have a python script that runs continuously as a WebJob (using Microsoft Azure), it generates some values (heart beat rate) continuously, and I want to display those values in my Web App.
I don't know how to proceed to link the WebJob to the web app.
Any ideas ?
You have two main options:
You can have the WebJobs write the values to a database or to Azure Storage (e.g. a queue), and have the Web App read them from there.
Or if the WebJob and App are in the same Web App, you can use the file system. e.g. have the WebJob write things into %home%\data\SomeFolderYouChoose, and have the Web App read from the same place.
You would need to provide some more information about what kind of interface your web app exposes. Does it only handle normal HTTP1 requests or does it have a web socket or HTTP2 type interface? If it has only HTTP1 requests that it can handle then you just need to make multiple requests or try and do long polling. Otherwise you need to connect with a web socket and stream the data over a normal socket connection.
I have a website which uses Amazon EC2 with Django and Google App Engine for its powerful Image API and image serving infrastructure. When a user uploads an image the browser makes an AJAX request to my EC2 server for the Blobstore upload url. I'm fetching this through my Django server so I can check whether the user is authenticated or not and then the server needs to get the url from the App Engine server. After the upload is complete and processed in App Engine I need to send the upload info back to the django server so I can build the required model instances. How can I accomplish this? I was thinking to use urllib but how can I secure this to make sure the urls will only get accessed by my servers only and not by a web user? Maybe some sort of secret key?
apart from the Https call ( which you should be making to transfer info to django ), you can go with AES encryption ( use Pycrypto/ any other lib). It takes a secret key to encrypt your message.
For server to server communication, traditional security advice would recommend some sort of IP range restriction at the web server level for the URLs in addition to whatever default security is in place. However, since you are making the call from a cloud provider to another cloud provider, your ability to permanently control the IP address of either the client and the server may diminished.
That said, I would recommend using a standard username/password authentication mechanism and HTTPS for transport security. A basic auth username/password would be my recommendation(https:\\username:password#appengine.com\). In addition, I would make sure to enforce a lockout based on a certain number of failed attempts in a specific time window. This would discourage attempts to brute force the password.
Depending on what web framework you are using on the App Engine, there is probably already support for some or all of what I just mentioned. If you update this question with more specifics on your architecture or open a new question with more information, we could give you a more accurate recommendation.
SDC provides a secure tunnel from AppEngine to a private network elsewhere -- which could be your EC2 instance, if you run it there.