Giter Site home page Giter Site logo

milesrichardson / parsepy Goto Github PK

View Code? Open in Web Editor NEW
514.0 37.0 187.0 381 KB

A relatively up-to-date fork of ParsePy, the Python wrapper for the Parse.com API. Originally maintained by @dgrtwo

License: MIT License

JavaScript 1.46% Python 98.54%
parse-server python parse

parsepy's People

Contributors

asfdfdfd avatar billyto avatar bitmole avatar bradddd avatar ctrongminh avatar dankrause avatar danrobinson avatar deanq avatar dgadling avatar farin avatar ivannkf avatar jonmorehouse avatar jpoehnelt avatar konoufo avatar mau21mau avatar mgalves avatar milesrichardson avatar misterfitz avatar mtsgrd avatar niccokunzmann avatar pistatium avatar pktck avatar rbermudezg avatar rwitten avatar teehamaral avatar thelinuxkid avatar thibauddavid avatar tony-osibov avatar wm3ndez avatar yosit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parsepy's Issues

object.save() make all the keys dirty

I modified few attributes on an object and saved it.
gameScore.score = 2061
gameScore.save()
When querying from beforesave cloud code, request.object.dirtyKeys() returns all keys dirty... instead of just the modified keys.

Tests.py overwrites Cloud Code

Running tests.py writes into Parse as it clearly must in order to validate the installation. However, in contrast to adding new Classes and new instances of those classes in the appropriate store, the tests replace any existing cloud code. This is partially due to the way Parse implements cloud code.

At a minimum it seems like a good idea for the test module to confirm with the user prior to writing cloud code if there is some present. At the very least the README section on testing the installation could warn people about this.

exists query seems to give error

When I try and use exists filter, I get bad type for $exists. I assume I should be doing __exists='false'. Totally sorry if this is not supported or I am trying to use the exists filter wrong. I figured it would be either __exists='false' or __exists=false based on my best reading of the docs.

I am trying to find all users with a publisherId of 15 that have LoggedIn as (undefined).

Sample...

users = list(User.Query.filter(publisherId='15').filter(LoggedIn__exists='false').limit(1000))

Error when I do __exists='false'

Traceback (most recent call last):
  File "./parse_user_update_test.py", line 36, in <module>
    users = list(User.Query.filter(publisherId='15').filter(LoggedIn__exists='false').limit(1000).order_by("LoggedIn", descending=False))
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/query.py", line 102, in __iter__
    return iter(self._fetch())
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/query.py", line 117, in _fetch
    return self._manager._fetch(**options)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/query.py", line 41, in _fetch
    return [klass(**it) for it in klass.GET(uri, **kw).get('results')]
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/connection.py", line 108, in GET
    return cls.execute(uri, 'GET', **kw)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/connection.py", line 102, in execute
    raise exc(e.read())
parse_rest.core.ResourceRequestBadRequest: {"code":102,"error":"bad type for $exists"}

Error when i do __exists=false

Traceback (most recent call last):
  File "./parse_user_update_test.py", line 36, in <module>
    users = list(User.Query.filter(publisherId='15').filter(LoggedIn__exists=false).limit(1000).order_by("LoggedIn", descending=False))
NameError: name 'false' is not defined

Raw example from REST API https://www.parse.com/docs/rest#queries-constraints

curl -X GET \
  -H "X-Parse-Application-Id: v8ZPeTW4nKEHDmmaU6eJUiF2s3tE16yrYZzGzipR" \
  -H "X-Parse-REST-API-Key: 3hT7widAIBwKx3N3vcqCVU9P0CN2WCCKZ16ex7vD" \
  -G \
  --data-urlencode 'where={"score":{"$exists":true}}' \
  https://api.parse.com/1/classes/GameScore

Thanks again for such a great library.

Add ability to drop whole classes

It's possible to drop whole classes via the API. It doesn't seem to be documented, and it's unintuitive, but here it is:

ParseBase.POST("/schemas/{class}", _method="DELETE", _ClientVersion="browser")

I can add a "drop_class" class method to ParseBase, or to ParseResource - I'm not sure which one would be better.

enhancement proposal - objectsId argument for relation methods is error prone

Imagine you want to add one object to relation (imho the most common case)

s.addRelation('network', '_User', ['nUFjOYqcG4'])
vs
s.addRelation('network', '_User', 'nUFjOYqcG4')

first is correct and adds relation, second do nothing silently because string is iterable

There can be explicit check to disallow strings - not much pythonic
Better aPI woudle be accepting *args
s.addRelation('network', '_User', 'nUFjOYqcG4')
s.addRelation('network', '_User', 'nUFjOYqcG4', 'secondID')
but this is API incompatible

There is also option deprecate old style, accepts both *args or list for some time.
What do you think about it?

Unable to import ACL class

When I try to import the ACL class as described in the doc, I get the following error:

ImportError: cannot import name ACL

GeoPoint doesn't appear to support extra arguments, e.g. maxDistanceInMiles

The Parse REST API supports queries along the lines of "all locations within 10 miles", by passing the argument "maxDistanceInMiles to the filter constraint:

    "location": {
      "$nearSphere": {
        "__type": "GeoPoint",
        "latitude": 30.0,
        "longitude": -20.0
      },
      "$maxDistanceInMiles": 10.0
    }

However, while as of f679b4d we can use nearSphere:

nearby_restaurants = Restaurant.Query.filter(location__nearSphere=my_loc)

I don't see how in the current framework one could add both nearSphere and maxDistanceInMiles to the same constraint. I'm not even sure what it would look like, though perhaps the most plausible is something like

nearby_restaurants = Restaurant.Query.filter(location__nearSphere=my_loc,
                                                                        location__maxDistanceInMiles=10)

This would indicate that instead of having a finite list of operators that can follow __, we should always look for __ in an argument and add what follows to the list of constraints. I'm not sure if there would be undesired consequences. Any thoughts?

What would be a use-case for initializing users with password?

Maybe this is part of a larger discussion to see how we are using this library, but I fail to see in which point of the application I would even have information about a user's password.

What I had implemented was simply mimicking the REST API:

  • User.signup would be a static method (and returning a User instance, but no session).
  • User.login would also be static method (returning a User instance and the key for the active session)

In both cases, the password is not part of what is returned in the response from Parse. What am I missing?

Relation and Array support

Is anyone working on relation and array support? I see some references to them in the code but it seems like its a work in progress. I'd be happy to flesh these capabilities out if nobody is working on them.

AttributeError: type object 'ParseBase' has no attribute 'register'

I installed parse_base as follows:

sudo easy_install parse_base

Hello, when I try to do a simple register

import parse_rest
parse_rest.ParseBase.register("ab", "cd")

I get this error:

AttributeError: type object 'ParseBase' has no attribute 'register'

Is this expected? Or am I missing something obvious?

Attempt to set ACL returns "object has no attribute 'ACL'"

    answer.User = user
    answer.ACL.set_user(user, read=True, write=True)
    answer.ACL.set_default(read=True)
    answer.ACL.set_role('admin', read=True, write=True)
    answer.save();

returns:

Traceback (most recent call last):
File "./fix_Question.py", line 32, in
answer.ACL.set_user(user, read=True, write=True)
File "/usr/local/lib/python2.7/dist-packages/parse_rest-0.2.20141004-py2.7.egg/parse_rest/datatypes.py", line 326, in getattr
return object.getattribute(self, attr) #preserve default if attr not exists
AttributeError: 'Question' object has no attribute 'ACL'

User.current_user() never seems to be working for me.

Traceback (most recent call last): File "app-test.py", line 152, in test_session_token me = User.current_user() File "/usr/local/lib/python2.7/dist-packages/parse_rest/user.p current_user return cls(**User.GET(user_url)) File "/usr/local/lib/python2.7/dist-packages/parse_rest/connec 30, in GET return cls.execute(uri, 'GET', **kw) File "/usr/local/lib/python2.7/dist-packages/parse_rest/connec 24, in execute raise exc(e.read()) ResourceRequestNotFound: {"code":101,"error":"invalid session"}

This is the error I keep getting. I have tried doing the login and then immediately using the Session Token to get the current user and it never works. Can someone please help?

recursion when saving Installation

installations = Installation.Query.all()
for installation in installations:
    installation.save()

got a RuntimeError: maximum recursion depth exceeded in __instancecheck__

Can't save associated items

A ParseObject cannot be saved as the attribute of a different ParseObject:

def testAssociatedObject(self):
    collectedItem = CollectedItem(type="Sword", isAwesome=True)
    collectedItem.save()
    self.score.item = collectedItem
    self.score.save()

raises the exception:

Traceback (most recent call last):
  File "/Users/dgrtwo/Repositories/ParsePy/parse_rest/tests.py", line 114, in testAssociatedObject
    self.score.save()
  File "/Users/dgrtwo/Repositories/ParsePy/parse_rest/__init__.py", line 261, in save
    self._create()
  File "/Users/dgrtwo/Repositories/ParsePy/parse_rest/__init__.py", line 269, in _create
    response_dict = self.__class__.POST(uri, **self._to_native())
  File "/Users/dgrtwo/Repositories/ParsePy/parse_rest/__init__.py", line 194, in POST
    return cls.execute(uri, 'POST', **kw)
  File "/Users/dgrtwo/Repositories/ParsePy/parse_rest/__init__.py", line 160, in execute
    data = kw and json.dumps(kw) or "{}"
  File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/json/encoder.py", line 201, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/json/encoder.py", line 264, in iterencode
    return _iterencode(o, 0)
  File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/json/encoder.py", line 178, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <parse_rest.tests.CollectedItem object at 0x101422550> is not JSON serializable

This is because ParseResource does not know how to turn itself into a Pointer.

Add an installation entry to Installation table

Any suggestion on how to add a new entry to Installation table? Any convenient way to keep track of current installation like in android api (getCurrentInstallation)?
any comment will be appreciated.

This is what I currently do: (deviceType is required but values are limited to "ios", "android", "winrt", "winphone", or "dotnet", though my device is none of these types)

currentInstallation = Installation(user=username, installationId=uuid, deviceType='android')
currentInstallation.save()
(then serialize currentInstallation for later start up)

Installation classes are broken

In [1]: from parse_rest import installation
-----------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-eecd0979afb9> in <module>()
----> 1 from parse_rest import installation

 (...)parse_rest/installation.py in <module>()
     22 
     23 
---> 24 class InstallationQuery(Query):
     25     def _fetch(self):
     26         opts = dict(self._options)  # make a local copy

NameError: name 'Query' is not defined

Update PyPi

The README is no longer valid for the current version in PyPi, and the lack of versions means it can't be included in a requirements.txt via -e <githubURL>

This is the library Parse refers people to, please keep it up to date :(

Running into - ResourceRequestNotFound: {"code":101,"error":"invalid session"}

The user logs and may perform a few requests but after some time they end up with
ResourceRequestNotFound: {"code":101,"error":"invalid session"}
I guess this is because the user is logged out or sessionToken is lost.
I'm using flask for this.

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/rohitmittal/Downloads/NewResikshaServer/stilt_api.py", line 79, in get_current_user
    current_user = User.current_user()
  File "/Library/Python/2.7/site-packages/parse_rest/user.py", line 97, in current_user
    return cls(**User.GET(user_url))
  File "/Library/Python/2.7/site-packages/parse_rest/connection.py", line 133, in GET
    return cls.execute(uri, 'GET', **kw)
  File "/Library/Python/2.7/site-packages/parse_rest/connection.py", line 127, in execute
    raise exc(e.read())
ResourceRequestNotFound: {"code":101,"error":"invalid session"}

Recursion on datatypes.py convert_to_parse method

Due to the fact that str objects in Python 3 have an __iter__ attribute using hasattr(python_object, '__iter__') is no longer sufficient. It is necessary to also check the object type for str. I have submitted a PR that solves one such instance of this issue.

#61

config/global.json

After installing the command line tools and setting up the cloud code as dictated here : https://www.parse.com/docs/cloud_code_guide

I keep getting this error:

E..................................

ERROR: test_simple_functions (main.TestFunction)

test hello world and averageStars functions

Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/parse_rest/tests.py", line 394, in setUp
with open("config/global.json", "w") as outf:
IOError: [Errno 2] No such file or directory: 'config/global.json'


Ran 35 tests in 37.125s

FAILED (errors=1)

The directory I am trying to run "python -m 'parse_rest.tests' looks like this:
cloud config public settings_local.py settings_local.pyc

Proposal for some concessions on pep8.

Now that pep8 is going through a revision, could I propose some slight customizations to the coding guidelines? Nothing big. The pep8 config file that I normally use is:

[pep8]
max-line-length = 96
ignore = E123,E701,E126,E261

max-line-length is obvious. The other errors that I ignore are just to allow one-line conditional statements (eg: if not x: return False), the requirement that inline comments must have two spaces after the end of the statement, and the one about closing brackets being on the same indentation-level as the opening one - which emacs' python-mode seem to hate with a passion.

Upload File/Images.

Right now there is no way to upload files/images to Parse through our library. We need to implement these functions on the File/Image data types.

containedIn/$in query

Is there a way to do a "containedIn" style query as described by the Parse API docs? In the REST API this is the $in parameter key.

UserQuery is now broken.

Let's say I want to get a list of users:

>>> from parse_rest import UserQuery

>>> UserQuery().fetch()
*** AttributeError: 'UserQuery' object has no attribute '_options'

It looks like the new __init__ for UserQuery is at fault.

Saving JSON object

I could not figure out how to save a dictionary in parse.com as JSON object. I was only able to convert the dictionary to a string and save it to parse.com string data-type which will make JSON elements inaccessible in queries

[Not Exactly Issue] Has anyone used this library successfuly with Django?

This library looks amazing but I was wondering if anyone has managed to use it with Django instead of the Django models. It looks like both APIs are somewhat similar (I think you did it on purpose) but I'm curious how/where should I put the register(<application_id>, <rest_api_key>[, master_key=None]) function call and get some advice.

I know the Django admin is not going to work out of the box (and actually it may take a lot of effort to make it work with this library) but I like a lot the views' system and project structure of Django.

Thanks in advance and keep up the good work! ๐Ÿ‘

MIT/BSD Licensing?

IANAL, but it's my understanding that if all contributors agree to change in terms of the license, we can "un-GPL" it.

I think that it's safe to say that, with all the changes we've done to the original code base, our "fork" is no longer a fork. Given that the original repo has no activity for the past 11 months, I would guess that if we could change our licensing to a more liberal one if we get authorization from the contributors to your repo (who have commits).

Thoughts?

X-Parse-Session-Token support ?

Any plans for supporting something similar to Parse.become ?

Am thinking something like,

register(APPLICATION_ID, REST_API_KEY, master_key=None, session_token='')

Then all subsequent requests would be by whichever user the token belongs to.

I suppose ultimately, would like to have

with sessionToken('token123'):
Appointment.Query.all()
...

Push Success/Failure Response?

Something like:

print Push.alert(
        {"alert": "Testing push through alerts",
         "from": "name"},
         channels=["channel1"]
);

would output:

{"result":True}

or

{"result":False, "error":"..."}

Is anyone on this? If not I can get started with it.

AttributeError: type object 'ParseBase' has no attribute 'CONNECTION'

I installed parse_rest from source by cloning this repository:

git clone [email protected]:dgrtwo/ParsePy.git

and then performing the following commands:

python setup.py build
sudo python setup.py install

I then ran the tests.py, everything worked! Sweet. However, I noticed that the tests.py file does not actually import parse_rest, instead it imports "__ init__ "as parse_rest.

Per the documentation my programs should simply import parse_rest. I used a snippit from tests.py to test this out, however it gives the following error:

Traceback (most recent call last):
File "tests_simple.py", line 29, in <module>
for s in GameScore.Query.all():
File "/Library/Python/2.7/site-packages/parse_rest/query.py", line 103, in __iter__
return iter(self._fetch())
File "/Library/Python/2.7/site-packages/parse_rest/query.py", line 112, in _fetch
return self._manager._fetch(**options)
File "/Library/Python/2.7/site-packages/parse_rest/query.py", line 35, in _fetch
return [klass(**it) for it in klass.GET(uri, **kw).get('results')]
File "/Library/Python/2.7/site-packages/parse_rest/__init__.py", line 110, in GET
return cls.execute(uri, 'GET', **kw)
File "/Library/Python/2.7/site-packages/parse_rest/__init__.py", line 71, in execute
if not ParseBase.CONNECTION:
AttributeError: type object 'ParseBase' has no attribute 'CONNECTION'

Here is the code that fails:

import parse_rest
from parse_rest.datatypes import Object

try:
    import settings_local
except ImportError:
    sys.exit('You must create a settings_local.py file with APPLICATION_ID, ' \
                 'REST_API_KEY, MASTER_KEY variables set')

parse_rest.ParseBase.register(
    getattr(settings_local, 'APPLICATION_ID'),
    getattr(settings_local, 'REST_API_KEY'),
    master_key=getattr(settings_local, 'MASTER_KEY')
    )

class GameScore(Object):
    pass

for s in GameScore.Query.all():
        s.delete()

scores = [GameScore(score=s, player_name='John Doe') for s in range(1, 6)]
for s in scores:
        s.save()

batch_save error with "unexpected keyword argument 'batch'"

I am trying to do a batch save and getting an error I can't figure out. From what I can tell, I am following the readme batch instructions. Anything obvious I am doing wrong or perhaps batch save of users is broken?

Essentially what I am doing in pseudocode...

from parse_rest.connection import register
register('appkey', 'restkey', master_key='masterkey')
from parse_rest.user import User
users = list(User.Query.filter(SomeFieldOfMine='15').limit(1000))
usersBatch = []
for u in users:
    u.SomeFieldOfMine = 'Touched'
    try:
        usersBatch.extend(u)
    except TypeError:
        usersBatch.append(u)

from parse_rest.connection import ParseBatcher
batcher = ParseBatcher()
batcher.batch_save(usersBatch)

ERROR

Traceback (most recent call last):
  File "./update_user.py", line 48, in <module>
    batcher.batch_save(usersBatch)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/connection.py", line 142, in batch_save
    self.batch([o.save for o in objects])
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/connection.py", line 132, in batch
    queries, callbacks = zip(*[m(batch=True) for m in methods])
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/parse_rest/user.py", line 27, in ret
    return func(obj, *args, **kw)
TypeError: save() got an unexpected keyword argument 'batch'

Bug with object own `__init__` and Query method

Hi,

I'm still a bit new to Python and after creating a class with its own __init__ method, the Query method doesn't work properly. If a comment my __init__ method, then the object get retrieve properly. I suppose my __init__method override something in the Object class, But it is fairly basic as you can see:

def __init__(self, name):
    self.name = name
    self.tasks = []
    List.listcount = List.listcount + 1

And the retrieving code is also pretty simple:

mylists = List.Query.all()
for mylist in mylists:
    print mylist.name
    print mylist.tasks

I could rewrite everything to not use my own __init__ method, but I would like not to do that as it keeps my code easier to understand. Any ideas on how to fix that? Thanks.

Breakage in

I upgraded from 6/28/14 (18d1642) and today (7/19/14, ffacfc4).

A script that saved an object that owned a pointer broke. Error was:

File "src/scripts/parseScripts/shipping/shippingReceived.py", line 98, in main
order.save()
File "/usr/local/lib/python2.7/dist-packages/parse_rest/datatypes.py", line 254, in save
return self._update(batch=batch)
File "/usr/local/lib/python2.7/dist-packages/parse_rest/datatypes.py", line 272, in _update
response = self.class.PUT(self._absolute_url, batch=batch, *_self._to_native())
File "/usr/local/lib/python2.7/dist-packages/parse_rest/connection.py", line 112, in PUT
return cls.execute(uri, 'PUT', *_kw)
File "/usr/local/lib/python2.7/dist-packages/parse_rest/connection.py", line 72, in execute
data = kw and json.dumps(kw) or "{}"
File "/usr/lib/python2.7/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 178, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <User:[email protected] (Id N7kzJmloHR)> is not JSON serializable

Update PyPI?

Hi:

This is a great module. I have been using it a fair bit and it appears to be fairly stable. Unfortunately the version in PyPI is not. Would it be possible to update PyPI. I'm deploying my code using AWS ELBS and it works well installing modules directly from PyPI , not so much with git.

Once again, thanks for working on this module!

QueryManagers are gone?

The idea of using a metaclass for the creation of a ParseObject class is good. Not so sure about just having a Queryset being instantiated directly, unless it is possible to create custom query objects for different classes.

For instance, Installation can only be queried if we pass the master key. It needs to have a custom _fetch method.

I took the QueryManager/Queryset paradigm from django. Unless you see something wrong with the approach, may I suggest getting it back?

bug with bidirectional pointers

For example if I have two objects that points to each other.
objectA.objectB_pointer
objectB.objectA_pointer

When querying one of the objects the code enters an infinite loop and eventually crashes with a "Maximum recursion depth exceeded" Error.

documentation improvement: raw queries

I need request to reset password endpoint. Documentation says nothing about such functionality. Digging code, solution is quite easy

ParseBase.execute('/requestPasswordReset', 'POST', email='[email protected]')

it would be nice document it or offer another public api.

Querying for a file not existing

Hi guys,

I can't express the below Javascript query using ParsePy. The query returns objects where the "video" field isn't set and "video" is of type File.

var query = new Parse.Query(Classname);
query.notEqualTo("video", null);

I've tried
Classname.Query.all().filter(video__neq = None)
with no success.

Best,
Rafi

TestUser fail with error : Parse::UserCannotBeAlteredWithoutSessionError

Hi,

While running the full test, all the test passed except the 4 last TestUser, they all seem to fail when trying to delete the user. I configured the settings_local.py file with the three app id, rest key and master key as described in the documentation.

Here are the messages i get:

python -m unittest parse_rest.tests
Uploading source files
Finished uploading files
Not creating a release because no files have changed
................................EEEE
======================================================================
ERROR: testCanLogin (parse_rest.tests.TestUser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "parse_rest/tests.py", line 462, in tearDown
    self._destroy_user()
  File "parse_rest/tests.py", line 441, in _destroy_user
    user and user.delete()
  File "parse_rest/user.py", line 27, in ret
    return func(obj, *args, **kw)
  File "parse_rest/user.py", line 76, in delete
    return User.DELETE(self._absolute_url, extra_headers=session_header)
  File "parse_rest/connection.py", line 142, in DELETE
    return cls.execute(uri, 'DELETE', **kw)
  File "parse_rest/connection.py", line 124, in execute
    raise exc(e.read())
ResourceRequestBadRequest: {"code":206,"error":"Parse::UserCannotBeAlteredWithoutSessionError"}


======================================================================
ERROR: testCanSignUp (parse_rest.tests.TestUser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "parse_rest/tests.py", line 459, in setUp
    u.delete()
  File "parse_rest/user.py", line 27, in ret
    return func(obj, *args, **kw)
  File "parse_rest/user.py", line 76, in delete
    return User.DELETE(self._absolute_url, extra_headers=session_header)
  File "parse_rest/connection.py", line 142, in DELETE
    return cls.execute(uri, 'DELETE', **kw)
  File "parse_rest/connection.py", line 124, in execute
    raise exc(e.read())
ResourceRequestBadRequest: {"code":206,"error":"Parse::UserCannotBeAlteredWithoutSessionError"}


======================================================================
ERROR: testCanUpdate (parse_rest.tests.TestUser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "parse_rest/tests.py", line 459, in setUp
    u.delete()
  File "parse_rest/user.py", line 27, in ret
    return func(obj, *args, **kw)
  File "parse_rest/user.py", line 76, in delete
    return User.DELETE(self._absolute_url, extra_headers=session_header)
  File "parse_rest/connection.py", line 142, in DELETE
    return cls.execute(uri, 'DELETE', **kw)
  File "parse_rest/connection.py", line 124, in execute
    raise exc(e.read())
ResourceRequestBadRequest: {"code":206,"error":"Parse::UserCannotBeAlteredWithoutSessionError"}


======================================================================
ERROR: testUserAsQueryArg (parse_rest.tests.TestUser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "parse_rest/tests.py", line 459, in setUp
    u.delete()
  File "parse_rest/user.py", line 27, in ret
    return func(obj, *args, **kw)
  File "parse_rest/user.py", line 76, in delete
    return User.DELETE(self._absolute_url, extra_headers=session_header)
  File "parse_rest/connection.py", line 142, in DELETE
    return cls.execute(uri, 'DELETE', **kw)
  File "parse_rest/connection.py", line 124, in execute
    raise exc(e.read())
ResourceRequestBadRequest: {"code":206,"error":"Parse::UserCannotBeAlteredWithoutSessionError"}


----------------------------------------------------------------------
Ran 36 tests in 91.651s

FAILED (errors=4)

Count queries are limited by the limit

Since count queries, e.g. Object.Query.all().count, seem to run a query and just take the length, they are limited to the number of elements that the query will return, which can never exceed 1000.

For right now, a fix is to sort the objects by something unique to each object, e.g. the objectId, and then add 1000 to the skip value each time until no queries are returned.

Object is not callable or unexpected keyword

I was instantiating the parse object with no arguments and set the properties after the instantiation and the error that appeared was "foo is no callable". So i wrote all the properties of the Object in the instantiation, and now the error is "_parse() got an unexpected keyword argument 'bar'.
The class is:
class foo(Object):
pass.

What do i do? (Sorry for my english)

ParseResource lazy loading fails

I believe that this commit causes ParseResource lazy loading to fail: 2fde657

It completely short-circuits lazy loading my toggling the _is_loaded flag without ever fetching anything. I've left a comment on the commit with a bit more depth. I believe it should be reverted to fix the issue.

Issue running the test - Windows

I'm running this on Windows 7, using an Anaconda installation.

One thing I had to do which was missing from the instructions (maybe it's obvious to others) was after the pip install step, I also had to manually download setup.py and place it in the same directory as settings_local.py.

Once I did that - I ran the test, and got the following:

running test

E.......................

======================================================================

ERROR: test_simple_functions (parse_rest.tests.TestFunction)

test hello world and averageStars functions

----------------------------------------------------------------------

Traceback (most recent call last):

File "C:\Anaconda\lib\site-packages\parse_rest\tests.py", line 334, in setUp

os.chdir(cloud_function_dir)

WindowsError: [Error 2] The system cannot find the file specified: 'C:\\Anaconda\\lib\\site-packages\\parse_rest\\cloudcode'

----------------------------------------------------------------------

Ran 24 tests in 148.804s

FAILED (errors=1)

Looks like it is expecting a directory named cloudcode (which is not necessarily the name one would have given their cloud directory) and for it to be located under site-packages\parse_rest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.