-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSoup.py
More file actions
32 lines (23 loc) · 844 Bytes
/
Soup.py
File metadata and controls
32 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 12 15:05:25 2017
@author: yzamriy
Goal: Function returning Soup object based on the specified url reference
Input: URL Reference, string
This is the string that follows "http://usapl.liftingdatabase.com"
Retruns: Beautiful Soup object
"""
from bs4 import BeautifulSoup
import urllib3
def getSoup(reference):
'''
Input: reference, string. Part of the url address for target page
Returns: beautiful soup object
'''
url = "http://usapl.liftingdatabase.com" + "/" + reference
http = urllib3.PoolManager()
response = http.request('GET', url)
return BeautifulSoup(response.data, "lxml")
#reference = "competitions"
#competitions = getSoup(reference)
#comptable = competitions.find("table", class_="tabledata").find('tbody').find_all('tr')