lyricsgenius

Library

  • Reference
  • Release notes

Guide

  • Setup
  • Usage
  • How It Works
  • Text Formatting
  • Other Guides
    • Request Errors

Misc

  • Contributing
  • Whoops!
lyricsgenius
  • Other Guides
  • View page source

Other Guides

Request Errors

The package will raise all HTTP and timeout erros using the HTTPError and Timeout classes of the requests package. Whenever an HTTP error is raised, proper description of the error will be printed to output. You can also access the response’s status code.

from requests.exceptions import HTTPError, Timeout
from lyricsgenius import Genius

try:
    Genius('')
except HTTPError as e:
    print(e.errno)    # status code
    print(e.args[0])  # status code
    print(e.args[1])  # error message
except Timeout:
    pass
Previous Next

© Copyright 2025, John W. R. Miller, Allerter.

Built with Sphinx using a theme provided by Read the Docs.