input: from typing import Optional
  import requests
  
  def read_url(url: str) -> Optional[str]:
      """Read the contents from a given URL and return the text if the request is successful, otherwise return None.
      >>> read_url('https://example.com')
      '<!doctype html><html><body>Example Domain</body></html>'
      >>> read_url('https://nonexistent.domain')
      None
      """
output:     try:
          response = requests.get(url)
          response.raise_for_status()
          return response.text
      except requests.RequestException:
          return None