← Back to challenges

Indicate the Media Type from HTTP Response Header

PythonHardstringslanguage_fundamentals

Instructions

Write a function that makes an HTTP GET request for the given url. Return the media type / content-type from the HTTP Response Header as a string.

Example

content_type("https://innokodakademija.com") ➞ "text/html; charset=utf-8"

Notes

  • You may want to make use of and import requests.
  • Do not cheat and just print out the answer, you must fetch this from innokodakademija.com.
  • Return the output as a string.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.