I am trying to pull information from a website, and doing so requires me to log into it. All goes well until I reach the submit button:
MissingSchema: Invalid URL u'/index.php?r=site/login': No schema supplied.
Perhaps you meant http:///index.php?r=site/login?
From what I can understand, this is happening because the website redirects itself to a page on the server. Is there a way to make the button redirect to the full page instead of a local file on the server? Or am I even correct on why this error is occuring?
Thanks In Advance
The Gist of My Code:
from twill.commands import *
go('panel.picklehosting.com/index.php?r=site/login')
showforms()
formclear('1')
fv("1", "name", "usrname")
fv("1", "password", "mypass")
submit()
I've been experiencing the same issue for a site I'm creating but I think I've solved it.
use the twill's formaction() function to set the action for the page you want. For example
from twill.commands import *
go('http://example.com/login')
showforms()
fv("1", "nameField", "username")
fv("1", "password", "password")
formaction('form','http://example.com/login')
submit("4")
show()
go('http://example.com/admin/')
or in your case
from twill.commands import *
go('panel.picklehosting.com/index.php?r=site/login')
showforms()
formclear('1')
fv("1", "name", "usrname")
fv("1", "password", "mypass")
formaction('form','panel.picklehosting.com/index.php?r=site/login')
submit()
go('panel.picklehosting.com/yourpage.php')
来源:https://stackoverflow.com/questions/28199938/using-twills-submit-function-when-websites-submit-button-is-localizedpython