I don't know if this has already been done, and no idea how useful this really is in practice, but I thought I'd give it a crack!
I wrote a real simple module for handling callbacks which allow you to decorate commands in a script as 'callback handlers' (basically, decorated Python functions taking any number of arguments), along with a URL generator for creating the callback URL to call the command in the current script or optionally in another script which also implements the callback handling.
The module is available here: https://gist.github.com/djbouche/5079561
Appreciate any feedback or suggestions!
Example (uses TweetBot module from https://gist.github.com/djbouche/5079739):
handler = callback.InfoHandler(sys.argv)
t = tweets.pop() #process next tweet on the list
#tweet, and send the list of remaining tweets down
else: #no more tweets
print 'Finished processing tweets!'
if name == "main" and not handler.handle():
#first entry point
f = open("tweets.txt","r") #read tweets from a file called 'tweets.txt'
a = f.read()
tweets = a.splitlines() #one line per tweet
tweets.reverse() #so we can pop them off
process_next(tweets) #start processing!