stopstalk / stopstalk-deployment

Stop stalking and start StopStalking :wink:
https://www.stopstalk.com
MIT License
314 stars 96 forks source link

Re-enable Codechef is_invalid_handle_check #381

Open raj454raj opened 4 years ago

raj454raj commented 4 years ago

Use https://github.com/stopstalk/stopstalk-deployment/blob/79911cdaf9e8ff0da963d044b286893144b189ec/modules/sites/codechef.py#L204 to replace https://github.com/stopstalk/stopstalk-deployment/blob/79911cdaf9e8ff0da963d044b286893144b189ec/modules/sites/codechef.py#L139

punndcoder28 commented 4 years ago

Hey! Can I take up this issue?

raj454raj commented 4 years ago

Hey @punndcoder28 ! You can surely take this up, let me know if you have any issues and feel free to raise a PR

punndcoder28 commented 4 years ago

Hey. If my understanding of the issue is correct do you want to replace the static method is_invalid_handle(handle with just _validate_handle(self)?

raj454raj commented 4 years ago

Hey @punndcoder28 ,

It's not that straight forward.

To use __validate_handle we need self.access_token to be set via __get_access_token method. You will have to think about how to make it independent of self and make it static method.

You can do something like the following -.

@staticmethod
def is_invalid_handle(handle):
    ...

@staticmethod
def __get_access_token():
    ...

@staticmethod
def __validate_handle(handle, access_token):
    ...

You can also test this without needing the Codechef api tokens, just return some dummy values and make sure with print statements are printed from web2py shell python web2py -S stopstalk -M

punndcoder28 commented 4 years ago

Hey @raj454raj . I've opened a PR #383. Can you check if this is right. Let me know if any mistakes are present or any changes are required.