Skip to main content

random-streetview

PyPI Python

One call, one random Street View panorama. Google is worldwide and the default; Naver and Kakao return road-view panoramas from South Korea.

pip install random-streetview
from random_streetview import random_panorama

pano = random_panorama()

pano.id       # 'ptFCsB5aFyaWDDlpbCliVw'
pano.lon      # 2.2954822
pano.lat      # 48.8583758
pano.platform # 'google'
pano.url      # 'https://www.google.com/maps/@?api=1&map_action=pano&pano=...'

Panorama is a named tuple, so panoid, lon, lat, platform = random_panorama() works too (platform defaults to 'google' when constructed directly).

Nothing raises on a network or parsing failure — you get None once the attempts are used up.

Platforms

random_panorama()                     # Google, worldwide (default)
random_panorama(platform="naver")     # Naver, South Korea
random_panorama(platform="kakao")     # Kakao, South Korea

platform is one of "google", "naver", "kakao"; anything else raises ValueError. pano.platform records which one produced the result, and pano.url builds the matching map link.

Naver and Kakao only cover South Korea, so their candidate coordinates are drawn from inland Korea rather than the worldwide lists Google uses. Both hit undocumented internal map endpoints — same no-key, no-guarantees caveat as Google below — and return None rather than raising when they come up empty.

Timeouts

random_panorama(max_retry=10, timeout=3.0)   # the defaults

timeout is per request, in seconds, and is raised to 0.5 if you ask for less. A single call budgets at most 30 seconds of timeout across its attempts, so max_retry is an upper bound rather than a promise: at timeout=10.0 you get 3 attempts, not 10. The default pairing is sized to reach all 10. Time actually spent on the wire does not count against the budget — only the timeouts do.

How it works, and why it can break

Picking a coordinate at random mostly lands you in the ocean, so candidates come from randomstreetview.com and wandery.it, which keep lists of places known to have coverage. Each candidate is then resolved to a panorama id through GeoPhotoService.SingleImageSearch, an undocumented internal Google Maps endpoint.

That means no API key — and no guarantees. The scraped sites will change their HTML, and Google can alter or start refusing that endpoint at any time; when that happens this library returns None rather than breaking your program. If you need something dependable, use the official Street View Static API metadata endpoint with a key instead (metadata requests are not billed).

Requests are not rate-limited for you. Space out your calls.

Development

uv sync
uv run pytest    # fully offline; network calls are monkeypatched

License

MIT

Release files for random-streetview 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for random-streetview 0.2.0
File Size Uploaded
random_streetview-0.2.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for random-streetview 0.2.0
File Interpreter ABI Platform
random_streetview-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / random_streetview-0.2.0.tar.gz

Download URL random_streetview-0.2.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f566c8789389753c6f15abc50570caad6d01ab16c8c4f11afc79b4bf30c49842
BLAKE2b-256 checksum
How to use checksums
61d1170c43cfedfeabcc61f959ab41f136cb9d23687aa2632c572b234ea66cbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / random_streetview-0.2.0-py3-none-any.whl

Download URL random_streetview-0.2.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c22c8d8fc550e5aeeb2a9aa98619afb0c4b4bf9b81f9c9566cb90cf0c10b6dd
BLAKE2b-256 checksum
How to use checksums
8421ff9571aad0c82f463d36c522cbcf28be260fd3bee32f755c478ff2df368b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page