Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

EarthView: read key from GOOGLE_MAPS_API_KEY to avoid clash with Gemini's GOOGLE_API_KEY

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Review Sources.py and EarthView.__init__, then run the TestEarthViewKey tests in tests/test_image_sources.py. The issue says the change is already implemented on fix/earthview-maps-key-env; rebase on main if needed, open a PR, and check the RVC3 text and notebooks for instructions that still recommend GOOGLE_API_KEY. Done means the PR is opened and those instructions are updated where necessary.

Written by the indexing model from the issue text.

Description

enhancement

EarthView reads its Google Maps key only from the GOOGLE_API_KEY environment variable (Sources.py, EarthView.__init__). That is also the first name Google's Gemini libraries (google-genai) check, so anyone with both a Maps key and a Gemini key can only satisfy one of them: whichever key is in GOOGLE_API_KEY, the other tool gets the wrong one.

Proposed fix

Read GOOGLE_MAPS_API_KEY first, falling back to GOOGLE_API_KEY so existing setups keep working:

self.key = os.getenv("GOOGLE_MAPS_API_KEY") or os.getenv("GOOGLE_API_KEY")

and update the docstring to explain the lookup order, recommend GOOGLE_MAPS_API_KEY, and advise restricting the key to the Maps Static API with a daily quota (an unrestricted Maps key that leaks can run up charges).

Status

Implemented and tested on branch fix/earthview-maps-key-env (commit 4e12d1b), not yet opened as a PR:

  • EarthView.__init__ lookup changed as above, docstring updated
  • 4 new tests in tests/test_image_sources.py (TestEarthViewKey): Maps key preferred, GOOGLE_API_KEY fallback, explicit key= wins, no key gives None; no network access needed
  • tests/test_image_sources.py passes (13 passed, 20 skipped for optional extras) in a clean venv
Possible follow-up

With no key at all, self.key is None and the failure only shows up later as an HTTP error from Google. A clear error at construction time (or on first grab) naming both environment variables would be friendlier.

To finish

Open a PR from the branch (rebase on main first if it has moved), and update the RVC3 text/notebooks if they tell readers to set GOOGLE_API_KEY.

Dominant language
Python
Stars
223
Forks
30
Avg merge
1h 4m
Merged PRs (30d)
9

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from petercorke/machinevision-toolbox-python

All issues in petercorke/machinevision-toolbox-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.