Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#125 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
computer-vision

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
223
Fork
30
Merge trung bình
1 giờ 4 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của petercorke/machinevision-toolbox-python

Tất cả issue của petercorke/machinevision-toolbox-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.