Developers

Flat
Python API wrapper
User: sparr
Date: 2/28/2017 10:56 pm
Views: 468
Rating: 0

https://github.com/sparr/thegamecrafter-python

I forked this from a project that provided a wrapper to a vaguely similar API for another service. It's far from ideal, but it does abstract away a few things. Here's my script to take a deck's back image and apply it to every card in the deck:

TGC = TheGameCrafter(username=username, password=password, apikey=apikey)
deckback = TGC.minideck.fetch('22AB99A0-EF07-11E6-8A06-2939B5F93AEC').back_id
card_ids = [card['id'] for card in TGC.minideck.cards('22AB99A0-EF07-11E6-8A06-2939B5F93AEC').all()]
for card_id in card_ids:
    print card_id
    TGC.minicard.update(card_id,back_from='Card',back_id=deckback)
    time.sleep(1)

PreviousNext