Exemplo n.º 1
0
    def does_image_id_exist(self, image_id):
        q = InstaStore.all(keys_only=True)
        q.filter('image_id =', image_id)
        result = q.get()

        if result:
            return True

        return False
Exemplo n.º 2
0
    def insert_to_datastore(self, image):

        try:
            caption = image['caption']['text']
        except TypeError:
            caption = ''

        insta_img = InstaStore(
            caption=caption,
            created=datetime.datetime.fromtimestamp(int(image['created_time'])),
            image_id=image['id'],
            image_photo_url=image['images']['standard_resolution']['url'],
            image_photo_thumbnail_url=image['images']['thumbnail']['url'],
            image_url=image['link'],
            user_avatar_url=image['user']['profile_picture'],
            user_id=image['user']['id'],
            user_name=image['user']['username'],
            user_real_name=image['user']['full_name'],
            user_url='http://instagram.com/%s' % image['user']['username']
        )
        insta_img.put()

        print 'Added %s to the datastore' % image['link']
Exemplo n.º 3
0
 def get(self):
     query = InstaStore.all(keys_only=True)
     entries =query.fetch(1000)
     db.delete(entries)