I hope this helps everyone out :)
https://gist.github.com/4130373
My code dynamically generates a .mobileconfig file which is normally used to provision iOS devices. One of the things it can provision is the installation of webclips to custom URLs (with custom icons).
... Unfortunately the built-in web browser in Pythonista doesn't seem to be able to install them ... but with a little switchery trickery, we can use both Mobile Safari and Pythonista together!
When you run the code, it starts a web server in Pythonista - and copies the URL for the generated .mobileconfig file to the clipboard. When you switch to Safari and attempt to load the URL, the socket connects - but it's waiting for communication from the web server in Pythonista (which is paused, since it's in the background).
As soon as you switch back to Pythonista, this un-pauses the web server fast enough to cause Safari to finish loading the .mobileconfig file while it's swapping to the background, which then triggers the installation screen!
Once it's served up a single mobileconfig file, the script stops.
If you want to remove the web clip you create, you can 'x' it out - but be aware it leaves the installation profile behind (Settings -> General -> Profiles), which you should probably also remove.
I made the code pretty clear where you can set the icon label name, script name, arg string, and payload name (the name that shows in the profile list). Both the profile and web clip payloads are generated with random UUIDs, so you can have as many installed as you like - installing one won't replace / modify another.
If you want a different icon for your webclips, the data is just a base64 encoded raw .png file. Feel free to swap it out.
Also, if someone would like to put a pretty interactive interface on this (before I do), by all means please do :)
Right now, though, I gotta get some ZZZzzs before Turkey Day.
Quick Edit: While I remember it - I'm doing args as a blank string currently. If you do intend to pass a complex argstring, you'll probably need to URL encode it. Just an FYI.