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

Check YouTube for Bok-Choy #3948

Merged
merged 1 commit into from
Jun 2, 2014
Merged

Conversation

muhammad-ammar
Copy link
Contributor

No description provided.

@muhammad-ammar
Copy link
Contributor Author

@jzoldak @auraz @polesye Please Review.

@auraz
Copy link
Contributor

auraz commented Jun 2, 2014

👍

except requests.exceptions.ConnectionError:
return False

if response.status_code != 200:
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@polesye
Copy link
Contributor

polesye commented Jun 2, 2014

👍

from bok_choy.promise import EmptyPromise


def youtube_availability():
Copy link
Contributor

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"

@jzoldak
Copy link
Contributor

jzoldak commented Jun 2, 2014

👍

muhammad-ammar added a commit that referenced this pull request Jun 2, 2014
@muhammad-ammar muhammad-ammar merged commit 4f55c82 into master Jun 2, 2014
@muhammad-ammar muhammad-ammar deleted the ammar/check-youtube-for-bok-choy branch June 2, 2014 18:27
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