Compare commits

...

3 Commits

Author SHA1 Message Date
simon 6c5185c59d
fix version tag push 2022-08-16 15:12:06 +07:00
simon f131507dd3
bump version 2022-08-16 15:08:44 +07:00
simon a3dc0d5c07
don't raise exception on 404 2022-08-16 15:06:33 +07:00
3 changed files with 6 additions and 5 deletions

View File

@ -45,7 +45,7 @@ function publish {
python -m build
twine upload dist/*
git tag -a "$VERSION" -m "new release version $VERSION"
git push "$VERSION"
git push origin "$VERSION"
}
if [[ $1 == "publish" ]]; then

View File

@ -9,7 +9,7 @@ from time import sleep
import requests
API_URL = "https://returnyoutubedislikeapi.com"
HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.5"}
HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.6"}
class Login:
@ -218,13 +218,14 @@ class VoteGet:
def _get_vote(youtube_id):
"""get vote from a single video"""
url = f"{API_URL}/votes?videoId={youtube_id}"
votes = None
try:
votes = requests.get(url, headers=HEADERS, timeout=3)
except requests.exceptions.RequestException:
sleep(5)
votes = requests.get(url, headers=HEADERS, timeout=5)
if not votes:
if votes is None:
raise ConnectionError("failed to connect to API")
if votes.ok:
@ -232,7 +233,7 @@ class VoteGet:
parsed["status"] = votes.status_code
del parsed["dateCreated"]
else:
print(f"{youtube_id}: API returns error code {votes.status_code}.")
print(f"{youtube_id}: RYD returns error code {votes.status_code}.")
parsed = {
"id": youtube_id,
"status": votes.status_code,

View File

@ -7,7 +7,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="ryd-client",
version="0.0.5",
version="0.0.6",
author="Simon",
author_email="simobilleter@gmail.com",
description="api client for returnyoutubedislike.com",