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.4.tar.gz (14.8 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.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wplace-0.0.4.tar.gz
Algorithm Hash digest
SHA256 89ccb699d2d486891504eab43d935dcaa4fb76dd0fdccb64a40b882f43cb71c8
MD5 e595a7ccccaf276acca96743a2969cd9
BLAKE2b-256 1a13a56b23ad47462410b48840710df9544f80c4b663871ea2c427cf595385a3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wplace-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ce99edc4f657b359992554f1cd54f1f135b34dccd295de7fb1aeed00db2d36ef
MD5 f724f63b3aa1d493ae5208098bbc35e2
BLAKE2b-256 c9974dcd7ffc6af71019f16ef974f8a0150d10f65a7ac0ef294dd47095f426a8

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