ThisPersonDoesNotExistAPI
To install:
pip install thispersondoesnotexist
Unofficial "API" for the ThisPersonDoesNotExist website.
What is ThisPersonDoesNotExist?
A page that returns a JPEG picture of a person that does not exist, because it has been generated using an AI. When opening the webpage, a image is returned directly, and refreshing the page will return a new image (although they can be repeated because the repository is limited and images are not generated on real time).
Some articles about it:
- This Person Does Not Exist - Computer generated people Refresh to get a new one | Product Hunt
- Thispersondoesnotexist.com is face-generating AI at its creepiest
Why creating/using an "API"?
Why not? Use your imagination!
Requirements
- Python 3.6
- requests library
- free time
Usage
Get a person using function
from thispersondoesnotexist import get_online_person
picture = await get_online_person() # bytes representation of the image
# Save to a file
from thispersondoesnotexist import save_picture
await save_picture(picture, "a_beautiful_person.jpeg")
# If no filename is provided, one will be generated using the checksum of the picture
await save_picture(picture)
Get a person using class
from thispersondoesnotexist import Person
# Initialize with True to automatically get a person from the webpage
person = Person(fetch_online=True)
# Save to a file
await person.save("a_beautiful_person.jpeg")
# If no filename is provided, one will be generated using the checksum of the picture
await person.save()
Generate checksums
This can be useful if you want to create a scraper of fictional persons. You would be calling the methods to get random pictures, and to avoid repeating them, you can use their checksum - or just save with the auto-generated filename.
from thispersondoesnotexist import get_online_person, get_checksum_from_picture, Person
# Using object
person = Person(fetch_online=True)
checksum = person.get_checksum("md5")
# Using function
picture = await get_online_person()
checksum2 = get_checksum_from_picture(picture) # Method is optional, defaults to "md5"
Metadata
Release files for thispersondoesnotexist 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| thispersondoesnotexist-1.0.2.tar.gz | 3.4 kB | Without provenance | Details |
Release files / thispersondoesnotexist-1.0.2.tar.gz
| Download URL | thispersondoesnotexist-1.0.2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df57f8b753bd0616fce8bc9af3e6ef62ee249d2b01128ebbd04d4e8ed70128cf
|
|
BLAKE2b-256 checksum How to use checksums |
06a06bbc9f934343928767dae6cf6bf16525cb1f85892d7d32876cd5ce26ce8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.3
|
Security for thispersondoesnotexist 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.