Mar-23-2019, 09:55 AM
This code should go to the mp3 converter page and fill in the form with "just an example". It shows an error, which I don't know how to fix. I tried looking it up but didn't find anything. I would appreciate any kind of help very much. Thanks in advance!
from robobrowser import RoboBrowser br = RoboBrowser() br.open("https://ytmp3.cc/") form = br.get_form() form['input'] = 'just an example' br.submit_form(form)I tried doing the instructions what the error message said, but I don't know how to that exactly. Here is the line in which the error is caused and in which I probably need to pass the additional argument...
def parsed(self): """Lazily parse response content, using HTML parser specified by the browser. """ return BeautifulSoup( self.response.content, features=self.browser.parser )
Error:C:\Users\Valdis\PycharmProjects\automated\venv\lib\site-packages\robobrowser\browser.py:40: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 40 of the file C:\Users\Valdis\PycharmProjects\automated\venv\lib\site-packages\robobrowser\browser.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.
features=self.browser.parser
Traceback (most recent call last):
File "C:/Users/Vald/PycharmProjects/automated/youtube.py", line 7, in <module>
form['input'] = 'just an example'
File "C:\Users\Vald\PycharmProjects\automated\venv\lib\site-packages\robobrowser\forms\form.py", line 216, in __setitem__
self.fields[key].value = value
File "C:\Users\Vald\PycharmProjects\automated\venv\lib\site-packages\werkzeug\datastructures.py", line 794, in __getitem__
raise exceptions.BadRequestKeyError(key)
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.