Skip to content

Refactor/deduplicate print and graphql headers#499

Merged
anderdc merged 6 commits into
entrius:testfrom
dataCenter430:refactor/deduplicate-print-and-graphql-headers
Apr 16, 2026
Merged

Refactor/deduplicate print and graphql headers#499
anderdc merged 6 commits into
entrius:testfrom
dataCenter430:refactor/deduplicate-print-and-graphql-headers

Conversation

@dataCenter430
Copy link
Copy Markdown
Contributor

Summary

Extend the deduplication from #482 — eliminate three remaining instances of the same patterns.

  • Add _print(message, json_mode) helper to miner_commands/helpers.py, replacing three bare if not json_mode: console.print(...) blocks across post.py (2 sites) and check.py (1 site)
  • Add make_graphql_headers(token) factory to github_api_tools.py next to make_headers, replacing two inline {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'} dicts at execute_graphql_query and get_github_graphql_query
  • Replace hardcoded timeout=30 in get_github_user() with GITHUB_HTTP_TIMEOUT_SECONDS — the one call site missed by refactor: centralize GitHub API constants and deduplicate console.status pattern #482

Note: the timeout change is a behaviour change (30 s → 15 s per attempt); get_github_user has a 6-attempt retry loop so the tightening is intentional.

@dataCenter430 dataCenter430 force-pushed the refactor/deduplicate-print-and-graphql-headers branch 2 times, most recently from 76ebe71 to 412d362 Compare April 16, 2026 16:39
@dataCenter430 dataCenter430 force-pushed the refactor/deduplicate-print-and-graphql-headers branch from 412d362 to ed20ce6 Compare April 16, 2026 16:42
@anderdc anderdc added the refactor Code restructuring without behavior change label Apr 16, 2026
@anderdc anderdc merged commit 3cd5b40 into entrius:test Apr 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants