I have the following task
Write a function named "get_response" that three string parameters representing the protocol, name of a server, and a path for an HTTP GET request in this order. Return the response of an HTTPS GET request to the url formed by these inputs. The response should be returned as a string
I wrote the following code.
def get_response(protocol, server, path):
str = protocol + "://" + server + "/" + path
contents = urllib.request.urlopen(str).read()
return contents
I get the following thing when I run the code
b'pupils'
What the question wants is the string format and only "pupils" in the answer. I try to convert it into str, but it's not working.
Any suggestions?