Skip to content

Instantly share code, notes, and snippets.

@peterkodermac
Created November 23, 2016 06:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save peterkodermac/48b837283a735310b3aa7619d89870a4 to your computer and use it in GitHub Desktop.
Save peterkodermac/48b837283a735310b3aa7619d89870a4 to your computer and use it in GitHub Desktop.
Windows authentication, web login with python
import mechanize
import BeautifulSoup
import requests
from requests_ntlm import HttpNtlmAuth
from bs4 import BeautifulSoup
result=requests.get("www.url.com",auth=HttpNtlmAuth('domain\\username','password?'))
print result.content
soup=BeautifulSoup(result.content, "html.parser")
print result.content
print soup.find_all("h1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment