Hello!
I made a simple script to demonstrate how to create a bookmarklet in safari that calls a python script in pythonista and passes the current safari URL as a parameter to that script.
It's not rocket science, you can figure out the details yourself.
This is the JavaScript code you should use to create the bookmark. DoStuff is the name of the python script that is run in my example:
<pre>
javascript:(function(){if(document.location.href.indexOf('http')===0)document.location.href='pythonista://DoStuff?action=run&argv='+document.location.href;})();
</pre>
Now for the simple script. It just prints out the params passed to it except the name of the script itself:
<pre>
#DoStuff.py
import sys
import pprint
import console
console.clear()
pprint.pprint(sys.argv[1:])
</pre>
You get the idea! Lets go nuts! :)