Section A
Question 1 – File Manager
4.1
Created server using Visual Studio Code -
Brief demonstration on the creation of the project:
1) Created a project folder in terminal with following commands*cd C:\Users\Private\Desktop\Projects
*mkdir my_python_project
*cd my_python_project
2) Directory for .txt file storage*mkdir data
3) Created a python script under filemanagement.py and added the following codeScript-
Files stored as follows-
Execution is terminal should identify localhost:8000-
Files should be accessible using https on any web browser
4.2 Server created using Visual Studio Code1) Created server under file name dataaccessserver.py -
Established connection -
2) Created client under dataaccessclient.py-
Running scripts with the following outcomes established-
Data received from user 1 and 2-
2.2 Updated code to allow users to update the amount stored on the server Dataaccessserver.py-
Dataaccessclient.py-
Outcome after debugging and running codeDataaccessserver established connection-
Dataaccessclient received request of amount update-
Server scriptThe server now configures an extra update request form client, by generating random numbers
between 0 and 20 and randomly decides the increase or the decrease of the amount. The updated
amount is also sent back to the client
Client scriptThe client will first have to request the current amount, this request is sent to the server and it finally
receive and prints the updated amount.
Question 3 – Security Implementation
3.1 To establish this connection using ssl, we will have to create a SSL CertificateCommand for a self made ssl cserificate will be as follows
* openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 –nodes, The
command will make to files under key.pem and cert.pem (Gitlan, D. (2024))
The created server will be under securitycertserver.py
The client will be created under securitycertclient-
3. 2 The created security certificate has the command added* openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 –nodes
The outcome will be as follows* Generating a RSA private key...........................++++..................++++
writing new private key to 'key.pem'
----You are about to be asked to enter information that will be incorporated
into your certificate request.
----Country Name [AU]:
State or Province Name [Some-State]:
Locality Name []:
Organization Name [Internet Widgits Pty Ltd]:
Organizational Unit Name []:
Common Name []:
Email Address []:
Question 4 – Message Queues
We will first need to install the necessary packages to make sure the message queues will run.
Installing rabbitmq one of the ways we can assess this request. Firstly you need to install pyhton
using the commands as follows. (Herman, M. (2024))
*pip install pika
*pip install smtplib
This will allow you to run the pika and smtplib syntax on the code script. After you will code the
script and create the task sender file under producertasksende.py-
Next you will create a script under consumerworker.py. This will allow the users to receive
confirmation emails in sync, that will make the users experience much easier by moving n to the
next session without waiting for the confirmation message. (Collins, E. R. (2024))
Bibliography
Collins, E. R. (2024). Emily Rosemary Collins. Retrieved from https://blog.finxter.com/5best-ways-to-implement-a-queue-in-python/
GeeksforGeeks. (2024). Run Python File In Vscode. Retrieved from
https://www.geeksforgeeks.org/run-python-file-in-vscode/
Gitlan, D. (2024). How to Create a Self-Signed Certificate Using OpenSSL. Retrieved from
https://www.ssldragon.com/how-to/openssl/create-self-signed-certificateopenssl/
Herman, M. (2024). Sending Confirmation Emails with Flask, Redis Queue, and Amazon
SES. Retrieved from https://testdriven.io/blog/sending-confirmation-emails-withflask-rq-and-ses/
Kavya Tolety
Technical Content Writer, Tolety, K., Writer, T. C., Kavya Tolety is a
data science enthusiast passionate about simplifying complex data integration and
analysis topics. With hands-on experience in Python programming, Ahad, K. A.,
Agarwal, C., & Angel, S. (2024). Build Python Message Queue for Effective
Communication 101. Retrieved from https://hevodata.com/learn/python-messagequeue/
(N.d.-a). Retrieved from https://www.youtube.com/watch?v=FzqjtU2x6YA
(N.d.-b). Retrieved from https://www.youtube.com/watch?v=aWnT_BxUtU4
(N.d.-c). Retrieved from https://www.youtube.com/watch?v=OqqRvhl9As8
(N.d.-d). Retrieved from https://www.youtube.com/watch?v=3QiPPX-KeSc
PubNub. (2023). An Essential Guide to Socket Programming in Python: Client, Server, and
Peer-to-Peer Libraries. Retrieved from https://hackernoon.com/an-essential-guideto-socket-programming-in-python-client-server-and-peer-to-peer-libraries
RabbitMQ tutorial - “Hello World!”: RabbitMQ. (n.d.). Retrieved from
https://www.rabbitmq.com/tutorials/tutorial-one-dotnet
Rohinivsenthil. (n.d.). rohinivsenthil/rabbitrace: Visual Studio Code extension to help
manage RabbitMQ queues and exchanges. Retrieved from
https://github.com/rohinivsenthil/rabbitrace
Yahyapour, S. (2023). Retrieved from https://www.turing.com/kb/socket-programming-inpython
baeldung, W. by: (2024). Creating a Self-Signed Certificate With OpenSSL. Retrieved from
https://www.baeldung.com/openssl-self-signed-cert
dukburdukbur
76722 gold badges77 silver badges88 bronze badges, DavidDavid
16.1k2222 gold badges5656 silver badges6666 bronze badges, PybossPyboss
26133 silver badges22 bronze badges, icktoofayicktoofay
128k2323 gold
badges255255 silver badges235235 bronze badges, Kirk StrauserKirk Strauser
30.8k55 gold badges5151 silver badges6969 bronze badges, & Brandon
RhodesBrandon Rhodes
87.8k1616 gold badges109109 silver
badges149149 bronze badges. (1957). Basic Python client socket example.
Retrieved from https://stackoverflow.com/questions/-/basic-python-clientsocket-example