read_token¶
- read_token.read_token(text_file='API_token.txt')[source]¶
Retrieves the API token from a specified text file.
- Parameters:
text_file (str) – The path to the text file containing the API token. Defaults to ‘API_token.txt’.
- Returns:
The API token as a string.
- Return type:
str
- Raises:
FileNotFoundError – If the specified file does not exist.
ValueError – If the token file is empty.
Exception – For other issues that prevent reading the token, with a message indicating the error.