summaryrefslogtreecommitdiff
path: root/jfr_playoff/remote.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-21 00:42:00 +0100
committeremkael <emkael@tlen.pl>2018-02-21 00:42:00 +0100
commit83a00a66d80789aaaad9759c9a89d9980a6320ac (patch)
tree350dc7bb56a99707aebcebde91860808c16d5110 /jfr_playoff/remote.py
parent95270b1f32ff946879cc9d8d7d4fe5f33b3a2868 (diff)
Refactoring remote HTML retrieval to separate class
Diffstat (limited to 'jfr_playoff/remote.py')
-rw-r--r--jfr_playoff/remote.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/jfr_playoff/remote.py b/jfr_playoff/remote.py
new file mode 100644
index 0000000..b6d0a34
--- /dev/null
+++ b/jfr_playoff/remote.py
@@ -0,0 +1,13 @@
+import urllib
+
+from bs4 import BeautifulSoup as bs
+
+class RemoteUrl:
+
+ url_cache = {}
+
+ @classmethod
+ def fetch(cls, url):
+ if url not in cls.url_cache:
+ cls.url_cache[url] = urllib.urlopen(url).read()
+ return bs(cls.url_cache[url], 'lxml')