コード例 #1
0
  def twitter_scavenger(self):
    TWIITER_HOST = 'twitter.com'
    TWITTER_PATH = '/%s' % (urllib.quote(self.username))
    params = {}
    response = http_request(self.email, 'HEAD', TWIITER_HOST, TWITTER_PATH, params)

    return False if response.is_error() else True
コード例 #2
0
  def aboutme_scavenger(self):
    ABOUTME_HOST = 'about.me'
    ABOUTME_PATH = '/%s' % (urllib.quote(self.username))
    params = {}
    response = http_request(self.email, 'GET', ABOUTME_HOST, ABOUTME_PATH, params)

    if response['status'] != OK_CODE:
      return False
    print response['raw_data']
    return True
コード例 #3
0
  def pinterest_scavenger(self):
    PIN_HOST = 'pinterest.com'
    PIN_PATH = '/%s/' % (urllib.quote(self.username))
    params = {}
    response = http_request(self.email, 'GET', PIN_HOST, PIN_PATH, params)

    if response['status'] != OK_CODE:
      return False

    print response['raw_data']
    return True
コード例 #4
0
  def lastfm_scavenger(self):
    LASTFM_KEY = 'e5c40cb75a092823db9378c1437c3ec0'
    LASTFM_HOST = 'ws.audioscrobbler.com'
    LASTFM_PATH = '/2.0/'

    params = {
                "method" : "user.getinfo",
                "user" : urllib.quote(self.username),
                "api_key" :  LASTFM_KEY,
                "format" : "json"
             }

    response = http_request(self.email, 'GET', LASTFM_HOST, LASTFM_PATH, params)
    if response.is_error():
      return False

    message = response['raw_data']
    data = simplejson.loads(message)

    if 'error' in data:
      response['status'] = NOT_FOUND_ERROR_CODE

    return True if response['status'] < 400 else False
コード例 #5
0
  def soundcloud_scavenger(self):
    SOUNDCLOUD_KEY = 'ef463fabfe015083c72515e72bde117f'
    SOUNDCLOUD_HOST = 'api.soundcloud.com'
    SOUNDCLOUD_PATH = '/users.json'
    SOUNDCLOUD_LIMIT = 10

    params = {
                "client_id" : SOUNDCLOUD_KEY,
                "q" : urllib.quote(self.username),
                "limit" : SOUNDCLOUD_LIMIT
             }

    response = http_request(self.email, 'GET', SOUNDCLOUD_HOST, \
                                         SOUNDCLOUD_PATH, params)
    if response.is_error():
      return False

    message = response['raw_data']
    data = simplejson.loads(message)

    if len(data) == 0:
      response['status'] = NOT_FOUND_ERROR_CODE

    return True if response['status'] < 400 else False