How do I connect a python file to a web server?

I am looking for help on how to make my program connect to a server (e.g. chat.pythonanaconda.repl.co) and have the program and server exchange information. For example:

Program: Person connects
Server: Adds person to connected users, and sends data
Program: Person sends message
Server: Stores message, sends new data to all running programs

Does anybody know how to do this?

for the requests to the server, you could use urllib.request. Maybe websockets would work well for displaying the messages in realtime

1 Like