Let's get everything set up first. You'll need to give **ParsePy** your _Application Id_ and _Master Key_ (available from your Parse dashboard) in order to get access to your data.
Let's get everything set up first. You'll need to give **ParsePy** your _Application Id_ and _Master Key_ (available from your Parse dashboard) in order to get access to your data.
To create a new object of the Parse class _GameScore_:
To create a new object of the Parse class _GameScore_:
~~~~~ {python}
~~~~~ {python}
>>> gameScore = ParsePy.ParseObject("GameScore")
>>> gameScore = parse.ParseObject("GameScore")
>>> gameScore.score = 1337
>>> gameScore.score = 1337
>>> gameScore.playerName = "Sean Plott"
>>> gameScore.playerName = "Sean Plott"
>>> gameScore.cheatMode = False
>>> gameScore.cheatMode = False
...
@@ -72,13 +72,13 @@ Additional Datatypes
...
@@ -72,13 +72,13 @@ Additional Datatypes
If we want to store data in a ParseObject, we should wrap it in a ParseBinaryDataWrapper. The ParseBinaryDataWrapper behaves just like a string, and inherits all of _str_'s methods.
If we want to store data in a ParseObject, we should wrap it in a ParseBinaryDataWrapper. The ParseBinaryDataWrapper behaves just like a string, and inherits all of _str_'s methods.
>>> collectedItem.save() # we have to save it before it can be referenced
>>> collectedItem.save() # we have to save it before it can be referenced
...
@@ -89,7 +89,7 @@ We can store a reference to another ParseObject by assigning it to an attribute:
...
@@ -89,7 +89,7 @@ We can store a reference to another ParseObject by assigning it to an attribute:
We can also store geoPoint dataTypes as attributes using the format <code>'POINT(longitude latitude)'</code>, with latitude and longitude as float values
We can also store geoPoint dataTypes as attributes using the format <code>'POINT(longitude latitude)'</code>, with latitude and longitude as float values
We can also run more complex queries to retrieve a range of objects. For example, if we want to get a list of _GameScore_ objects with scores between 1000 and 2000 ordered by _playerName_, we would call:
We can also run more complex queries to retrieve a range of objects. For example, if we want to get a list of _GameScore_ objects with scores between 1000 and 2000 ordered by _playerName_, we would call: