Skip to main content

Utility classes and methods for Wplace.live

Project description

wplace

Utility classes and methods for Wplace.live

PyPI - Python Version PyPI - Downloads PyPI

Installation

wplace is available on pypi:

python3 -m pip install --upgrade wplace

Example

Basic usage example (can be found in examples/tile_image.py):

from wplace import Pixel, WplaceAPI

api = WplaceAPI()

wplace_link = "https://wplace.live/?lat=52.53835814390717&lng=13.37545865302734"
pixel = Pixel.from_link(wplace_link)
print(f"Selected pixel: {pixel!r}.")
pixel_info = api.fetch_pixel_info(pixel=pixel)
print(f"Pixel info: {pixel_info}")

region = pixel.region
print(f"Lies within {region!r}. Coords within region: {pixel.coords_in_region}.")
link = api.get_pixel_link(region.origin, select=True)
print(f"Navigate to region origin: {link}")

tile = pixel.tile
print(f"Lies within {tile!r}. Coords within tile: {pixel.coords_in_tile}.")
img_url = api.get_tile_url(tile)
print(f"Tile image URL: {img_url}")
chunk = api.fetch_tile_image(tile=tile)
chunk.show()

Output:

Selected pixel: Pixel(x=1100091, y=671480).
Pixel info: PixelInfo(painted_by=UserInfo(id=1, name='JohnDoe', alliance_id=None, alliance_name=None, country=None, discord_name=None), region=RegionInfo(id=85779, city_id=699, name='Berlin', number=7, country=Country(id=82, iso='DE', label='Germany')))
Lies within Region(x=275, y=167). Coords within region: (91, 3480).
Navigate to region origin: https://wplace.live/?lat=52.90885200790681&lng=13.359462890624988&select=0
Lies within Tile(x=1100, y=671). Coords within tile: (91, 480).
Tile image URL: https://backend.wplace.live/files/s0/tiles/1100/671.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wplace-0.0.5.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wplace-0.0.5-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file wplace-0.0.5.tar.gz.

File metadata

  • Download URL: wplace-0.0.5.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for wplace-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2fabd04c10ad04d257f1ca9c18191fb4ce49ceea6c7257250afb194cfe753e79
MD5 a7634afb7a5824314bd32245f48a48bf
BLAKE2b-256 e8dbe85b6884664eb2979272b7a3c6323b4c1e5e4443d0cc062179bba203d861

See more details on using hashes here.

File details

Details for the file wplace-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: wplace-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for wplace-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 22c6fb4804e96bbe1c0bdb87b6a03f28e9a8f3b9c3f358d2d5c305fca3308b93
MD5 9ed9bee3792e964886d333b5c49ec86d
BLAKE2b-256 265c4c9f00425a81c3573c295ca15f8c615cd13daad0ba08ff88afe33029a6b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page