def create_token(self, consumer, token_type, timestamp, user=None):
        token, created = self.get_or_create(consumer=consumer, 
                                            token_type=token_type, 
                                            timestamp=timestamp,
                                            user=user)

        if created:
            token.key, token.secret = self.generate_random_codes()
            token.save()

        return token
Shortcut to create a token with random key/secret.
dataset/ETHPy150Open dgraziotin/dycapo/piston/managers.py/TokenManager.create_token