old_contents: #!/usr/bin/env python
  
  """
  :copyright: (c) 2013 by Mike Taylor
  :license: MIT, see LICENSE for more details.
  
  IndieWeb Webmention Tools
  """
  
  import argparse
  import requests
  import ronkyuu
  
  if __name__ == '__main__':
      parser = argparse.ArgumentParser()
      parser.add_argument('sourceURL')
      parser.add_argument('--eventConfigFile', default=None)
  
      args = parser.parse_args()
      cfg  = ronkyuu.discoverConfig(args.eventConfigFile)
  
      domains   = [] #cfg.get('domains', [])
      sourceURL = args.sourceURL
  
      print('Scanning %s for mentions' % sourceURL)
  
      mentions = ronkyuu.findMentions(sourceURL, domains)
      for href in mentions:
          if sourceURL <> href:
              wmStatus, wmUrl = ronkyuu.discoverEndpoint(href)
              if wmUrl is not None and wmStatus == 200:
                  print('\tfound webmention endpoint %s for %s' % (wmUrl, href))
                  status_code = ronkyuu.sendWebmention(sourceURL, href, wmUrl)
  
                  if status_code == requests.codes.ok:
                      print('\twebmention sent successfully')
                  else:
                      print('\twebmention send returned a status code of %s' % status_code)
  
new_contents: #!/usr/bin/env python
  
  """
  :copyright: (c) 2013 by Mike Taylor
  :license: MIT, see LICENSE for more details.
  
  IndieWeb Webmention Tools
  """
  
  import argparse
  import requests
  import ronkyuu
  
  if __name__ == '__main__':
      parser = argparse.ArgumentParser()
      parser.add_argument('sourceURL')
      parser.add_argument('--eventConfigFile', default=None)
  
      args = parser.parse_args()
      cfg  = ronkyuu.discoverConfig(args.eventConfigFile)
  
      domains   = [] #cfg.get('domains', [])
      sourceURL = args.sourceURL
  
      print('Scanning %s for mentions' % sourceURL)
  
      mentions = ronkyuu.findMentions(sourceURL, domains)
      print mentions['refs']
      for href in mentions['refs']:
          if sourceURL <> href:
              print href
              wmStatus, wmUrl = ronkyuu.discoverEndpoint(href, test_urls=False)
              if wmUrl is not None and wmStatus == 200:
                  print('\tfound webmention endpoint %s for %s' % (wmUrl, href))
                  status_code = ronkyuu.sendWebmention(sourceURL, href, wmUrl)
  
                  if status_code == requests.codes.ok:
                      print('\twebmention sent successfully')
                  else:
                      print('\twebmention send returned a status code of %s' % status_code)
  
subject: update example to the new return value from findMentions