testing #14

Merged
pi-ux-ce merged 21 commits from testing into main 2026-06-25 21:24:16 +00:00
Showing only changes of commit 5432647293 - Show all commits
+28 -10
View File
@@ -4,7 +4,9 @@ from apps.bitwarden.utils import bitwardenUtils
class betaserieUtils(): class betaserieUtils():
url = "https://api.betaseries.com/members/auth" url = "https://api.betaseries.com/members/auth"
username_UID="7bc7ebd2-9c95-487f-9ba2-b47301591ef0"
password_UID="262c3246-203b-44e0-854b-b47301599730"
token_UID="2cf4be0f-f26f-473f-b8f1-b473016139e4" token_UID="2cf4be0f-f26f-473f-b8f1-b473016139e4"
#Adding __ to make the variable private and can't be access outside the class, #Adding __ to make the variable private and can't be access outside the class,
@@ -14,16 +16,32 @@ class betaserieUtils():
__organization_id = "a6361589-badd-4bde-9cb4-af8901161c0d" __organization_id = "a6361589-badd-4bde-9cb4-af8901161c0d"
bw = bitwardenUtils(__access_token,__organization_id) bw = bitwardenUtils(__access_token,__organization_id)
__betaserie_token = bw.read_value_secret(token_UID)
payload = {} __betaserie_username = bw.read_value_secret(username_UID)
__betaserie_md5_password = bw.read_value_secret(password_UID)
headers = { __betaserie_apikey = bw.read_value_secret(token_UID)
'X-BetaSeries-Key': __betaserie_token,
'X-BetaSeries-Token': __betaserie_token payload = {
'login': __betaserie_username, # username or email
'password': __betaserie_md5_password # MD5 hashed password
} }
headers = {
'X-BetaSeries-Key': __betaserie_apikey,
}
response = requests.post(url, headers=headers, data=payload)
#now set with the correct value
__betaserie_token = response.json()['token']
#set the __betaserie_token to the doct headers now
headers.update({'X-BetaSeries-Token': __betaserie_token})
def status_code(self):
print("Status code:", self.response.status_code)
print("Response:", self.response.json())
def identify_serie(self,serie_name,verbose=False): def identify_serie(self,serie_name,verbose=False):
# #
# Usage # Usage
@@ -59,11 +77,11 @@ class betaserieUtils():
def mark_episodes_watched(self,episode_id,verbose=False): def mark_episodes_watched(self,episode_id,verbose=False):
url = "https://api.betaseries.com/episodes/watched?id=episode_id" url = "https://api.betaseries.com/episodes/watched?id="+str(episode_id)
response = requests.request("POST", url, headers=self.headers, data=self.payload) response = requests.request("POST", url, headers=self.headers, data=self.payload)
if verbose: if verbose:
print("Url request: "+str(url)) print("Url request: "+str(url))
print(response.text) print(response.text)
print(response.text) return response