In my last post I discussed the names Python library that generates random names. I’ve now used this Python library to make a basic Flask website that generates random names. You can visit it at: http://www.pseudorandom.name
The font size and margin on pseudorandom.name change based on the web browser width and height. I determined the font sizes I wanted to use for each screen width by using the longest first and last name in the name files I’m using (11 and 13 characters respectively). The website looks reasonable on various desktop resolutions and on phone screens.
It’s an HTTP API
If curl is used to access the site, plain text is returned instead of an HTML webpage. For example:
The site is hosted on Heroku which doesn’t support bare domains.
Currently http://pseudorandom.name redirects to http://www.pseudorandom.name so
using the bare domain requires telling curl to follow redirects with
curl -L pseudorandom.name
More to come?
It might be nice to allow generating multiple names at once, generating gender-specific names, and maybe providing other content types (JSON). The HTML version could also use a cleaner, more feature-full design.
Also it would probably be more efficient to use a SQL database for querying random names so I may eventually abandon the names library and use a database for querying.