pastealacon backend: Support posting
The captcha is not handled but an exception is properly raised.
This commit is contained in:
parent
e5597424fc
commit
4dc3e56d18
4 changed files with 47 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue