Skip to content

CLN: Cleanup subclass #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2015
Merged

CLN: Cleanup subclass #110

merged 1 commit into from
Nov 11, 2015

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Oct 17, 2015

Closes #106. Clean-up most of classes to use common logic.

@femtotrader
Copy link
Contributor

Your BaseReader should probably have a _get_session method

def _get_session(self, session):
    """Returns a requests.Session if session is None
    or session if it's not None (cached session
    with requests-cache for example)
    :param session:
    :return:
    """
    if session is None:
        session = requests.Session()
    return session

and __init__ should accept a session parameter (default to None)

so we will do

self.session = self._get_session(session)

this will allow to pass a session (with proxy or cache)

@sinhrks sinhrks force-pushed the cln_subclass branch 2 times, most recently from e517194 to 66f8e65 Compare October 19, 2015 14:56
@sinhrks
Copy link
Member Author

sinhrks commented Oct 19, 2015

OK, updated to add a session, I've chosen a word "init" as it is not for getting.

BTW, found a problem that requests doesn't allow to specify pausing between retry. Thus, current pause kw can't work now... I'll implement retry-pause logic by myself.

@sinhrks
Copy link
Member Author

sinhrks commented Oct 20, 2015

Implemented the logic to handle retry and pause. Now ready for review.

@femtotrader
Copy link
Contributor

Sorry but I don't see recent commit (authored 11 days ago)

https://github.com/sinhrks/pandas-datareader/tree/cln_subclass

@sinhrks
Copy link
Member Author

sinhrks commented Oct 20, 2015

It's squashed to the single commit, following pandas manners.

@femtotrader
Copy link
Contributor

Ok yes sorry... I was mistaken by commit date.

+1 about for your cleanup and great work

@bashtage
Copy link
Contributor

Is anything in base for public use? If not private seems more correct.

@sinhrks
Copy link
Member Author

sinhrks commented Oct 23, 2015

@bashtage No, changed it to private. Rebased and squashed.

@davidastephens
Copy link
Member

Thanks @sinhrks This looks great.

davidastephens added a commit that referenced this pull request Nov 11, 2015
@davidastephens davidastephens merged commit 0e22ac1 into pydata:master Nov 11, 2015
@sinhrks sinhrks deleted the cln_subclass branch November 11, 2015 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants