Skip to main content

a very simple wrapper around requests/aiohttp for thispersondoesnotexist.com

Project description

tpdne-py

a very simple wrapper around requests/aiohttp for thispersondoesnotexist.com (and similar)

provides 4 objects, Person, Aioperson, Horse, and AioHorse usage:

from tpdne import Person

def main() -> None:
    x = Person()
    with open('test.png', 'wb') as f:
        f.write(x.bytes)

if __name__ == "__main__":
    main()
from tpdne import AioPerson
import asyncio

async def main() -> None:
    x = await AioPerson()
    with open('test.png', 'wb') as f:
        f.write(x.bytes)

if __name__ == "__main__":
    asyncio.run(main())

optionally fetch=False can be passed to the constructors so that the image can be fetched at a later time with Person.fetch() or await AioPerson.fetch()

from tpdne import Person

def main() -> None:
    x = Person(fetch=False)
    # do something
    bytes = x.fetch()
    with open('test.png', 'wb') as f:
        f.write(bytes)

if __name__ == "__main__":
    main()
from tpdne import AioPerson
import asyncio

async def main() -> None:
    x = await AioPerson(fetch=False)
    # do something
    bytes = await x.fetch()
    with open('test.png', 'wb') as f:
        f.write(bytes)

if __name__ == "__main__":
    asyncio.run(main())

fetch returns bytes so there is no need to directly access .bytes when manually fetching (fetch also updates the instance attribute on first invocation)

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

tpdne-py-0.0.5.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

tpdne_py-0.0.5-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file tpdne-py-0.0.5.tar.gz.

File metadata

  • Download URL: tpdne-py-0.0.5.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for tpdne-py-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9b3443dcb58b37f14a662d761d266ce0dfac8ccbe8b2239ee629ee22a36f3085
MD5 e8a2ecc272b942026ea8dda3f1e7b8f3
BLAKE2b-256 6289d1270d518e903dc772ab3b49e8370456572b1969dff5f84cdfb79a6841d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tpdne_py-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for tpdne_py-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 079fc14c2e1556da4e4eefdeb1a4af87da6500e607ee5ac49e11402b09ab7d36
MD5 fa5b8c0279729bde5c97c41a07dc630e
BLAKE2b-256 7530021ee605054f9986b51e16b1a249856ab9dd9e9bcb4eaae72b4b02f10181

See more details on using hashes here.

Supported by

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