1

I am making my way through python. Currently, I have a software where users will input some data and based on the data they enter they will get some output. At the moment, the software will be distributed as an exe file for windows users.

What I hope I can do now, is to let the software communicate with me over internet. I want the user input values that they put to be sent to me online. This will allow me to monitor my software performance and improve the service overtime with new releases.

Are there suggestions how to achieve this effeciently and in a relatively easy and straight forward manner?

Thank you in advance!

2
  • which type of communication you wanna make if just HTTP one you can use requests module or similar, which will work in a separate thread for not block your program execution or aiohttp in case if you use asyncio. if you wanna make communication-based on TCP or UDP sockets are the way to go also you can check the library (twisted). Another option is to use a WebSockets with that tornado kan help you Commented Jan 31, 2020 at 11:36
  • Thanks, I still going to check if I need more than HTTP. I am currently also try to understand the issue of security whenever an application is going to send information over the internet. This is essential for putting the right legal notice, so that users don't use something they don't know what it is doing in the background. Commented Feb 4, 2020 at 15:33

2 Answers 2

1

I am using bottle web-framework. Here is simple script for processing POSTed data. POSTed data are written in a terminal and returned to the client (server side):

from bottle import get, post, run, request
import sys

@get('/api')             #display information in client browser (not necessary)
def hello():
    return "This is api page for processing POSTed messages"

@post('/api')
def api():
    print(request.body.getvalue().decode('utf-8'), file=sys.stdout)
    return request.body  #here is reply to client

run(host='localhost', port=8080, debug=True)

Script for POSTing json data to the script above (client side):

import requests
payload = "Hello World"
url = "localhost:8080/api"
headers = {
  'content-type': "application/json",
  'cache-control': "no-cache"
  }
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank v. much, I think all the answers I got will help me find my start point. I also need to consider things like how secure such means of communications are, because I will give privacy notices to my cleints (end users). Therefore, I have to be legally correct and authentic about any internet functions that are to be included.
1

Socket integration would be great option as you need your application to be connected to the server for sending or receiving performance or updates.

Below link will guide you on how to develop both client and server side integration using python:

https://realpython.com/python-sockets/

1 Comment

I will check it out. Thanks Rahul for the advice!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.