mediawiki-utilities / python-mwapi

Simple Python Wrapper around MediaWiki API
http://pythonhosted.org/mwapi
MIT License
31 stars 11 forks source link

Requests Session no longer accepts params #1

Closed kracekumar closed 9 years ago

kracekumar commented 11 years ago

From requests 1.0.0 api for Session doesn't accept any parameter. Following code will break.

from mwapi import MWApi
m = MWApi(host="http://ta.wiktionary.org")

Link to new Api: https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L137

kracekumar commented 11 years ago

Seems there needs some amount of rewrite.

In [9]: m.get(params={'action': 'query', 'titles': 'time'})
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/hasgeek/codes/js/B2G/<ipython-input-9-7313cb8cb838> in <module>()
----> 1 m.get(params={'action': 'query', 'titles': 'time'})

/home/hasgeek/codes/python/python-mwapi/mwapi/__init__.py in get(self, params)
    111         params - Parameters to send to the API. Varies depending on the action to be performed.
    112         """
--> 113         return self.request('GET', params)
    114 
    115     def post(self, params):

/home/hasgeek/codes/python/python-mwapi/mwapi/__init__.py in request(self, method, params, data)
     52                 params=params,
     53                 data=data,
---> 54                 prefetch=True)
     55         return json.loads(resp.content)
     56 

TypeError: request() got an unexpected keyword argument 'prefetch'
kracekumar commented 11 years ago

prefetch needs to be stream from v1.0.0, citation: http://kennethreitz.com/announcing-requests-v100.html

halfak commented 9 years ago

It looks like this was fixed by https://github.com/yuvipanda/python-mwapi/pull/2