input: from typing import Optional
  
  
  def read_url(url: str) -> Optional[str]:
      """ Read the contents from a given URL and return its text if successful.
      If the request fails, return None.
      >>> read_url('https://www.example.com')
      'Example Domain description...'
      >>> read_url('http://invalid-url.com')
      None
      """
      try:
          r = requests.get(url)
          if r.status_code == 200:
              return r.text
          else:
              return None
      except requests.RequestException:
          return None
output:     import requests