One option would be to shell out netstat.exe and tasklist.exe and capture their stdout/stderr. Then parse the output into a hash table or whatever collection functionality Python has.
Use the process ID (PID) to match the process to the connection.
netstat.exe -on
tasklist.exe
You would need a loop with a delay in it to watch the processes and connections. You won't catch everything but it would fit the "need to build this at a very basic level" criteria.