Skip to content

Commit

Permalink
clean utils.py module
Browse files Browse the repository at this point in the history
  • Loading branch information
leVirve committed Jul 15, 2016
1 parent a1462ea commit 276110f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 8 additions & 2 deletions dcard/forums.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
import logging
try:
from dcard import api
from dcard.utils import Client, filter_general
from dcard.utils import Client
except ImportError:
from . import api
from .utils import Client, filter_general
from .utils import Client


logger = logging.getLogger('dcard')


def filter_general(forums):
for forum in forums:
if not forum['isSchool']:
yield forum


class Forum:

def __init__(self, forum):
Expand Down
10 changes: 1 addition & 9 deletions dcard/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@ def __init__(self):
self.session = FuturesSession(max_workers=10)

@staticmethod
def get(url, verbose=False, **kwargs):
def get(url, **kwargs):
response = requests.get(url, **kwargs)
if verbose:
logging.info(response.url)
return response.json()

def sget(self, url, **kwargs):
return self.session.get(url, **kwargs)


def filter_general(forums):
for forum in forums:
if not forum['isSchool']:
yield forum

0 comments on commit 276110f

Please sign in to comment.