Created
December 13, 2015 22:19
-
-
Save davidcomfort/0191fb3c369d1fe42471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
session = requests.Session() | |
url = "https://www.whatismybrowser.com/developers/what-http-headers-is-my-browser-sending" | |
req = session.get(url) | |
bsObj = BeautifulSoup(req.text) | |
print(bsObj.find("table",{"class":"table-striped"}).get_text) | |
<bound method Tag.get_text of <table class="table table-striped"> | |
<tr> | |
<th>ACCEPT</th> | |
<td>*/*</td> | |
</tr> | |
<tr> | |
<th>ACCEPT_ENCODING</th> | |
<td>gzip, deflate</td> | |
</tr> | |
<tr> | |
<th>HOST</th> | |
<td>www.whatismybrowser.com</td> | |
</tr> | |
<tr> | |
<th>USER_AGENT</th> | |
<td>python-requests/2.3.0 CPython/2.7.10 Darwin/15.0.0</td> | |
</tr> | |
</table>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment