Skip to content

Refactor encoding handling #160

Open
mrhx01 wants to merge 1 commit into
nasa:masterfrom
mrhx01:fix-apod-utility
Open

Refactor encoding handling #160
mrhx01 wants to merge 1 commit into
nasa:masterfrom
mrhx01:fix-apod-utility

Conversation

@mrhx01

@mrhx01 mrhx01 commented May 14, 2026

Copy link
Copy Markdown

Changes

  1. Added @fix_encoding decorator
  • Eliminates duplicate encoding logic in _title, _copyright, and _explanation functions
  • Provides centralized error handling and logging for encoding issues
  • Reduces code duplication by ~40 lines
  1. Removed global video_thumb from _get_thumbs
  • Replaced global variable with local variable
  • Fixes potential race condition and makes function thread-safe
  1. Modernized string formatting
  • Changed "%sap%s.html" % (BASE, date_str) to f-string f"{BASE}ap{date_str}.html"

Added a decorator to fix encoding issues in string return values across multiple functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant