Skip to content
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

Update of pycharts #15

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

VivienCabannes
Copy link

Replacement of YCharts api access point.
Replacement of urllib by requests.
Handling of 403 error with requests.

@KFoxder
Copy link
Contributor

KFoxder commented Oct 13, 2021

@VivienCabannes thank you for contributing. We will review this.

@KFoxder KFoxder self-assigned this Oct 13, 2021
Copy link

@apb514 apb514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge this? Ycharts changed the base_url last night and this PR fixes it.

Copy link
Contributor

@KFoxder KFoxder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apb514 @VivienCabannes can you fix the tests for this?

if you run python tests.py you will see 10 of them are failing.

class PyChartsRequestForbiddenException(PyChartsRequestException):

def __init__(self, error_message=None):
self.error_message = "The server refuses to authorize the request."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.error_message = "The server refuses to authorize the request."
self.error_message = 'The server refuses to authorize the request.'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, this is due to the fact that we used requests instead of urllib (which we have done for caching purposes). I would have to rewrite the tests file in order to mock requests rather than mocking urlib's urlopen function, are you okay with that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VivienCabannes Yeah that would be much appreciated as we no longer need to support 2.7

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your quick answers, I have looked a little bit about it, but that would take me too much time to implement the changes (about 90 minutes I believe), and as I am busy those days, I am afraid I will not be able to work on it at the moment.
I suggests two solutions:

  • either you only merge my commit "57385c5", and you update the url in the test file accordingly.
  • either you find someone to reimplement the unit test by mocking requests rather than urllib.
    I hope this help, sorry I do not have some much time to work on it.
    I might come back on it later if no one has fixed it.

Best regards
Vivien

@KFoxder KFoxder assigned VivienCabannes and unassigned KFoxder Nov 4, 2021
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