-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Check YouTube for Bok-Choy #3948
Conversation
👍 |
except requests.exceptions.ConnectionError: | ||
return False | ||
|
||
if response.status_code != 200: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check if status code is less that 400
status code?
if response.status_code < 400:
...
4xx and 5xx are error codes. But 204
code is successful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm...Actually I am not sure about this.
@auraz What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3xx are redirects, and if google does not do redirects, we should use at least < 300.
Regarding 2xx, 2xx are success so we should support them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Google does not redirects but the ISPs who are blocking YouTube can redirect. Here in my country YouTube is blocked and when you try to access, it will redirect to some other page by the ISP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing i forgot to mention is that in the above case request.get
gives me 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
👍 |
from bok_choy.promise import EmptyPromise | ||
|
||
|
||
def youtube_availability(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please name this "is_youtube_available"
👍 |
Check YouTube for Bok-Choy
No description provided.