legoktm / supersimplemediawiki

A python3 interface with MediaWiki's API
5 stars 2 forks source link

Example-script not working #5

Open Nudin opened 11 years ago

Nudin commented 11 years ago

Hi,

I wanted to use supersimplemediawiki – since it is exactly what I needed, but I'm getting an Keyerror when running has_new_messages.py:

Traceback (most recent call last):
  File "uploadimg.py", line 26, in <module>
    enwp.login(settings.username, settings.password)
  File "/home/michi/git/fremde/supersimplemediawiki/mw.py", line 60, in login
    r2 = requests.post(self.api, params=data, headers=self.headers, cookies=r1.cookies)
  File "/usr/lib/python3.3/site-packages/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/usr/lib/python3.3/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.3/site-packages/requests/sessions.py", line 327, in request
    self.cookies = cookiejar_from_dict(cookies, cookiejar=self.cookies, overwrite=False)
  File "/usr/lib/python3.3/site-packages/requests/cookies.py", line 410, in cookiejar_from_dict
    cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
  File "/usr/lib/python3.3/site-packages/requests/cookies.py", line 256, in __getitem__
    return self._find_no_duplicates(name)
  File "/usr/lib/python3.3/site-packages/requests/cookies.py", line 311, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name=Cookie(version=0, name='enwikiSession', value='0d4310fef7701c6aca7de88e4c49437a', port=None, port_specified=False, domain='en.wikipedia.org', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False), domain=None, path=None"

Any ideas whats going wrong?

fhocutt commented 10 years ago

Works for me. I ran:

> git clone https://github.com/legoktm/supersimplemediawiki.git
> cd supersimplemediawiki/
(edited settings.py to add my username/password)
> python3 has_new_messages.py
You have new messages!
> python has_new_messages.py 
You have new messages!