mcastle
mcastle

Reputation: 2982

How to use parse.com Session Token with ParsePy?

I am using parsepy as a wrapper for parse.com. I have a parse.com table called Player with objects that are linked by a one-to-one relationship using a pointer to a User object. The Player objects have ACL's allowing Public Read but not Public Write, and allows read and write by the user object with which it is linked.

Without passing a Session Token, parse.com returns an error when trying to write to the Player object, since Public write is not allowed by the Player object ACL. Using parsepy, how do I allow a user to write to their Player object? Is there a way to pass the user's Session Token to a parsepy save()?

Upvotes: 1

Views: 330

Answers (1)

sreenivas
sreenivas

Reputation: 2257

Taking the example from parsepy documentation:

u = User.login('dhelmet', '12345')
token = u.sessionToken

with SessionToken(token):
    collectedItem = CollectedItem.Query.get(type="Sword")
    collectedItem.name = "katana"
    collectedItem.save()

Upvotes: 1

Related Questions