pastealacon backend: Support posting

The captcha is not handled but an exception is properly raised.
This commit is contained in:
Laurent Bachelier 2011-04-14 00:36:48 +02:00 committed by Romain Bignon
commit 4dc3e56d18
4 changed files with 47 additions and 4 deletions

View file

@ -23,7 +23,7 @@ from weboob.tools.browser import BasePage
from urlparse import urlparse
import re
__all__ = ['PastePage']
__all__ = ['PastePage', 'PostPage', 'CaptchaPage']
class PastePage(BasePage):
def fill_paste(self, paste):
@ -40,3 +40,14 @@ class PastePage(BasePage):
"""
path = urlparse(self.url).path
return path[1:]
class PostPage(BasePage):
def post(self, paste):
self.browser.select_form(name='editor')
self.browser['code2'] = paste.contents.encode(self.browser.ENCODING)
self.browser['poster'] = paste.title.encode(self.browser.ENCODING)
self.browser['expiry'] = ['m']
self.browser.submit()
class CaptchaPage(BasePage):
pass