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

post() got multiple values for keyword argument 'connection error #22

Closed ustun closed 10 years ago

ustun commented 10 years ago

I'm getting the following error with the following sample case:

from firebase import firebase
firebase = firebase.FirebaseApplication('https://ustun-test.firebaseio.com', None)

new_activity = {
    "user": "Ustun",
    "action_type": "asked",
    "text": "a text questions",
    "url": "a url"
}

result = firebase.post('/activities', "x", {'print': 'pretty'}, {'a': 'b'})
print result

A sample traceback:

python firebase_integration.py
> /Users/ustun/scv14/lib/python2.7/site-packages/firebase/decorators.py(21)wrapped()
     20             import ipdb; ipdb.set_trace()
---> 21             return f(*args, **kwargs)
     22         return wraps(f)(wrapped)

ipdb> args
args = (<firebase.firebase.FirebaseApplication object at 0x10f05b910>, '/activities', 'x', {'print': 'pretty'}, {'a': 'b'})
kwargs = {'connection': <requests.sessions.Session object at 0x10f0ff890>}
ipdb> kwargs
{'connection': <requests.sessions.Session object at 0x10f0ff890>}
ipdb> c
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
firebase_integration.py in <module>()
      9 }
     10 
---> 11 result = firebase.post('/activities', "x", {'print': 'pretty'}, {'a': 'b'})
     12 print result

/Users/ustun/scv14/lib/python2.7/site-packages/firebase/decorators.py in wrapped(*args, **kwargs)
     19             connection.headers.update({'Content-type': 'application/json'})
     20             import ipdb; ipdb.set_trace()
---> 21             return f(*args, **kwargs)
     22         return wraps(f)(wrapped)
     23     return wrapper

TypeError: post() got multiple values for keyword argument 'connection'

Here is what args and kwargs are:

ipdb> args
args = (<firebase.firebase.FirebaseApplication object at 0x10b4df910>, '/activities', 'x', {'print': 'pretty'}, {'a': 'b'})
kwargs = {'connection': <requests.sessions.Session object at 0x10b583890>}
ipdb> kwargs
{'connection': <requests.sessions.Session object at 0x10b583890>}
ozgur commented 10 years ago

Can you open up a pull request for that?

ozgur commented 10 years ago

I think it's been fixed by this https://github.com/ozgur/python-firebase/pull/25. So closing this one.

akirashimosoeda commented 9 years ago

Still not working on Python 3.4.3

roshankhandelwal commented 9 years ago

Am facing the same issue . Post method in firebase.py : def post(self, url, data, connection, params=None, headers=None): Where connection is the third parameter .

With the example provided : result = f.post(url , data , {'print' : 'pretty'}) - then assigns the { print : pretty } to the connection and it also creates another one and hence i guess it fails . Removing this argument works fine .

ghost commented 8 years ago

Was this ever corrected? I am still receiving this error on P 2.7 with the latest build of this library. Any parameter as shown above produces this error.

2PacIsAlive commented 8 years ago

+1 removing the params and headers fixes the problem

wontonst commented 8 years ago

+1 please fix

DevLatBo commented 8 years ago

what was the solution??? I have the same problem :(

arushijain commented 8 years ago

I also am having the same issue!

DevLatBo commented 8 years ago

well i fixed in my case but... dont forget the "self" El 29/04/2016 16:58, "arushijain" notifications@github.com escribió:

I also am having the same issue!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ozgur/python-firebase/issues/22#issuecomment-215880187