diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | jfr_playoff/remote.py | 4 | ||||
-rw-r--r-- | jfr_playoff/settings.py | 5 |
3 files changed, 6 insertions, 5 deletions
@@ -13,6 +13,8 @@ Dla wersji skompilowanej: jakiś współczesny system rodziny MS Windows. Dla wersji skryptowej: * Python 2.x ze standardowym zestawem bibliotek * MySQL connector dla Pythona + * moduł requests + * moduł BeautifulSoup4 Instalacja ---------- diff --git a/jfr_playoff/remote.py b/jfr_playoff/remote.py index b6d0a34..f02a8d4 100644 --- a/jfr_playoff/remote.py +++ b/jfr_playoff/remote.py @@ -1,4 +1,4 @@ -import urllib +import requests from bs4 import BeautifulSoup as bs @@ -9,5 +9,5 @@ class RemoteUrl: @classmethod def fetch(cls, url): if url not in cls.url_cache: - cls.url_cache[url] = urllib.urlopen(url).read() + cls.url_cache[url] = requests.get(url).text return bs(cls.url_cache[url], 'lxml') diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py index acfd417..9d727a7 100644 --- a/jfr_playoff/settings.py +++ b/jfr_playoff/settings.py @@ -1,8 +1,8 @@ import glob import json import readline +import requests import sys -import urllib def complete_filename(text, state): @@ -26,8 +26,7 @@ class PlayoffSettings(object): overwrite=True): try: remote_config = new_config if new_config is not None else \ - json.loads(urllib.urlopen( - remote_url).read().decode('utf-8-sig')) + json.loads(requests.get(remote_url).text) for key, value in remote_config.iteritems(): if (key not in base_config) or overwrite: base_config[key] = value |