Ejemplo n.º 1
0
class TestClientSearches(unittest.TestCase):
    def setUp(self):
        self.pinata = PinterestPinata(email='*****@*****.**', password='******', username='******')

    @vcr.use_cassette('fixtures/vcr_cassettes/boards.yaml', record_mode='new_episodes')
    def test_boards(self):
        boards = self.pinata.boards('david')
        self.assertTrue(len(boards) > 10)
        self.assertEqual(boards[0]['id'], '111042015751340934')
        self.assertEqual(boards[10]['id'], '70509619105017041')

    @vcr.use_cassette('fixtures/vcr_cassettes/search_boards.yaml', record_mode='new_episodes')
    def test_search_boards(self):
        boards = self.pinata.search_boards('cats')
        self.assertTrue(len(boards) > 15)
        self.assertEqual(boards[0]['id'], '108508740961118549')
        self.assertEqual(boards[10]['id'], '562598247139642475')

    @vcr.use_cassette('fixtures/vcr_cassettes/search_pins.yaml', record_mode='new_episodes')
    def test_search_pins(self):
        pins = self.pinata.search_pins('persian cats')
        self.assertTrue(len(pins) > 20)
        self.assertEqual(pins[0]['id'], '456200637234822717')
        self.assertEqual(pins[0]['link'],
                         u'http://www.ourfurryfriendz.info/search/label/Top%207%20Most%20Affectionate%20Cat%20Breeds')
        self.assertEqual(pins[10]['id'], '376121006355425841')
        self.assertEqual(pins[10]['link'], u'http://instagram.com/p/ygKPwMRbas/')

    @vcr.use_cassette('fixtures/vcr_cassettes/search_users.yaml', record_mode='new_episodes')
    def test_search_users(self):
        users = self.pinata.search_users('benadolfsson')
        self.assertTrue(len(users) > 0)
        self.assertEqual(users[0]['username'], 'benadolfsson')
        self.assertEqual(users[0]['pin_count'], 25)
Ejemplo n.º 2
0
class TestClientSearches(unittest.TestCase):
    def setUp(self):
        self.pinata = PinterestPinata(email='*****@*****.**', password='******', username='******')

    def test_boards(self):
        self.assertTrue(len(self.pinata.boards('david')) > 10)

    def test_search_boards(self):
        self.assertTrue(len(self.pinata.search_boards('cats')) > 15)

    def test_search_pins(self):
        self.assertTrue(len(self.pinata.search_pins('persian cats')) > 5)
Ejemplo n.º 3
0
class TestClientSearches(unittest.TestCase):
    def setUp(self):
        self.pinata = PinterestPinata(email="*****@*****.**", password="******", username="******")

    @vcr.use_cassette("fixtures/vcr_cassettes/boards.yaml", record_mode="new_episodes")
    def test_boards(self):
        boards = self.pinata.boards("david")
        self.assertTrue(len(boards) > 10)
        self.assertEqual(boards[0]["id"], "111042015751340934")
        self.assertEqual(boards[10]["id"], "70509619105017041")

    @vcr.use_cassette("fixtures/vcr_cassettes/search_boards.yaml", record_mode="new_episodes")
    def test_search_boards(self):
        boards = self.pinata.search_boards("cats")
        self.assertTrue(len(boards) > 15)
        self.assertEqual(boards[0]["id"], "108508740961118549")
        self.assertEqual(boards[10]["id"], "562598247139642475")

    @vcr.use_cassette("fixtures/vcr_cassettes/search_pins.yaml", record_mode="new_episodes")
    def test_search_pins(self):
        pins = self.pinata.search_pins("persian cats")
        self.assertTrue(len(pins) > 20)
        self.assertEqual(pins[0]["id"], "456200637234822717")
        self.assertEqual(
            pins[0]["link"],
            u"http://www.ourfurryfriendz.info/search/label/Top%207%20Most%20Affectionate%20Cat%20Breeds",
        )
        self.assertEqual(pins[10]["id"], "376121006355425841")
        self.assertEqual(pins[10]["link"], u"http://instagram.com/p/ygKPwMRbas/")

    @vcr.use_cassette("fixtures/vcr_cassettes/search_users.yaml", record_mode="new_episodes")
    def test_search_users(self):
        users = self.pinata.search_users("benadolfsson")
        self.assertTrue(len(users) > 0)
        self.assertEqual(users[0]["username"], "benadolfsson")
        self.assertEqual(users[0]["pin_count"], 25)
Ejemplo n.º 4
0
 def setUp(self):
     self.pinata = PinterestPinata(email='*****@*****.**', password='******', username='******')
Ejemplo n.º 5
0
 def setUp(self):
     self.pinata = PinterestPinata(email="*****@*****.**", password="******", username="******")
Ejemplo n.º 6
0
from pinata.client import PinterestPinata

# Retreive results for Women's shoes category.
pinata = PinterestPinata(email='<email>', password='******', username='******')
pinata.create_board(name='dataset', category='women shoes', description='dataset board')
Ejemplo n.º 7
0
def get_pins(keyword = None):
    pinata = PinterestPinata(email=email, password=password, username=username)
    # pinata.create_board(name='my test board', category='food_drink', description='my first board')
    images = pinata.search_pins(query=keyword)
    return images
Ejemplo n.º 8
0
import pprint
from pinata.client import PinterestPinata

pinata = PinterestPinata(email='*****@*****.**', password='******', username='******')
boards = pinata.search_boards('cats')
pprint.pprint(boards)
#a=pinterest.auth pinata
#auth=pinterest.OAuthHandler('4869303750828763830')
#auth.set_access_token('cb1a4d9d657519dc7a03c8c1698353ac0b0c7a531433e9a0d66cd652e991b7ee')

#pinterest_api = pinterest.API(auth)

#glitter_pins = pinterest_api.search(
#    q="glitter beards"
#)
#for pin in glitter_pins:
 #   pprint.pprint(pin.user.name + ": " + pin.text)
Ejemplo n.º 9
0
 def setUp(self):
     self.pinata = PinterestPinata(email='*****@*****.**', password='******', username='******')