You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
534 B
14 lines
534 B
5 years ago
|
import requests
|
||
|
from bs4 import BeautifulSoup
|
||
|
import urllib.parse
|
||
|
''' From https://stackoverflow.com/questions/42002336/using-python-requests-module-to-login-on-an-wordpress-based-website'''
|
||
|
|
||
|
if __name__=="__main__":
|
||
|
s=requests.Session()
|
||
|
link="http://example.invalid/wp-login"
|
||
|
initial=s.get(link)
|
||
|
|
||
|
login_data={"log":"individual@example.invalid","pwd":"passwordgoeshere",'rememberme':'forever','redirect_to':'http://example.invalid/dash/', 'redirect_to_automatic': '1'}
|
||
|
page_login=s.post(link, data=login_data)
|
||
|
print(page_login)
|