import requests

def tweets(url):
  api = "http://urls.api.twitter.com/1/urls/count.json?url="
  respobj = requests.get(api + url)
  adict = respobj.json()
  return adict["count"]

def plusses(url):
  import requests
  api = "https://clients6.google.com/rpc"
  jobj = '''{
    "method":"pos.plusones.get",
    "id":"p",
    "params":{
        "nolog":true,
        "id":"%s",
        "source":"widget",
        "userId":"@viewer",
        "groupId":"@self"
        },
    "jsonrpc":"2.0",
    "key":"p",
    "apiVersion":"v1"
  }''' % (url)
  respobj = requests.post(api, jobj)
  adict = respobj.json()
  return adict['result']['metadata']['globalCounts']['count']

def shares(url):
  api = "http://graph.facebook.com/?id="
  respobj = requests.get(api + url)
  adict = respobj.json()
  return adict["shares"]



@@ -196,26 +196,8 @@
 l):%0A
-  import requests%0A
   ap
@@ -752,32 +752,41 @@
  respobj.json()%0A
+  try:%0A  
   return adict%5B%22
@@ -794,10 +794,29 @@
 hares%22%5D%0A
+  except:%0A    pass%0A
 %0A%0A

Put in a try for shares function