ozgur / python-firebase

Python interface to the Firebase's REST API
http://ozgur.github.com/python-firebase/
MIT License
593 stars 155 forks source link

Order by (orderBy) filter requires quoted param in get request #64

Open sshadmand opened 8 years ago

sshadmand commented 8 years ago

Using: result = firebase_app.get("/", "article", params={"startAt": "100", "orderBy": "msrp"}) Return the error Bad Request for url: https://pennywise.firebaseio.com/article.json?orderBy=msrp&startAt=10

To get it working, a manual insertion of quotes is required. result = firebase_app.get("/", "article", params={"startAt": "100", "orderBy": "\"msrp\""}) Returns successfully

My issue, if the orderBy params requires quotes it should be handled in the backend call.

jmtoung commented 8 years ago

I got the same issue, but doing the manual insertion of quotes did not work for me. Can @sshadmand , or someone please help?

response = firebase.get('/', "orders", params={"orderBy": "\"CreatedTime\""})

Traceback (most recent call last): File "test_get_orders.py", line 11, in response = firebase.get('/', "orders", params={"orderBy": "\"CreatedTime\""}) File "/Library/Python/2.7/site-packages/python_firebase-1.2-py2.7.egg/firebase/decorators.py", line 19, in wrapped return f(_args, _kwargs) File "/Library/Python/2.7/site-packages/python_firebase-1.2-py2.7.egg/firebase/firebase.py", line 274, in get return make_get_request(endpoint, params, headers, connection=connection) File "/Library/Python/2.7/site-packages/python_firebase-1.2-py2.7.egg/firebase/decorators.py", line 19, in wrapped return f(_args, _kwargs) File "/Library/Python/2.7/site-packages/python_firebase-1.2-py2.7.egg/firebase/firebase.py", line 42, in make_get_request response.raise_for_status() File "/Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/models.py", line 840, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://log.firebaseio.com/orders.json?orderBy=%22CreatedTime%22