yt-dlp-host-api 0.0.5__py3-none-any.whl → 0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
yt_dlp_host_api/client.py CHANGED
@@ -25,12 +25,13 @@ class Client:
25
25
  return False
26
26
  return True
27
27
 
28
- def create_key(self, name, permissions):
28
+ def create_key(self, name, permissions, response_json=False):
29
29
  data = {"name": name, "permissions": permissions}
30
30
  response = requests.post(f"{self.host_url}/create_key", json=data, headers=self.headers)
31
31
  if response.status_code != 201:
32
32
  raise APIError(response.json().get('error', 'Unknown error'))
33
- return response.json()
33
+ if response_json: return response.json()
34
+ return response.json()['key']
34
35
 
35
36
  def delete_key(self, name):
36
37
  response = requests.delete(f"{self.host_url}/delete_key/{name}", headers=self.headers)
@@ -38,14 +39,15 @@ class Client:
38
39
  raise APIError(response.json().get('error', 'Unknown error'))
39
40
  return response.json()
40
41
 
41
- def get_key(self, name):
42
- response = requests.delete(f"{self.host_url}/get_key/{name}", headers=self.headers)
42
+ def get_key(self, name, response_json=False):
43
+ response = requests.get(f"{self.host_url}/get_key/{name}", headers=self.headers)
43
44
  if response.status_code != 200:
44
45
  raise APIError(response.json().get('error', 'Unknown error'))
45
- return response.json()
46
+ if response_json: return response.json()
47
+ return response.json()['key']
46
48
 
47
- def list_keys(self):
48
- response = requests.get(f"{self.host_url}/list_keys", headers=self.headers)
49
+ def get_keys(self):
50
+ response = requests.get(f"{self.host_url}/get_keys", headers=self.headers)
49
51
  if response.status_code != 200:
50
52
  raise APIError(response.json().get('error', 'Unknown error'))
51
53
  return response.json()
yt_dlp_host_api/task.py CHANGED
@@ -34,11 +34,12 @@ class TaskResult:
34
34
  self.client = client
35
35
  self.status = status
36
36
 
37
- def get_file(self):
37
+ def get_file(self, raw_response=False):
38
38
  url = self.get_file_url()
39
39
  response = requests.get(url, headers=self.client.headers)
40
40
  if response.status_code != 200:
41
41
  raise APIError(response.json().get('error', 'Unknown error'))
42
+ if raw_response: return response
42
43
  return response.content
43
44
 
44
45
  def get_file_url(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yt_dlp_host_api
3
- Version: 0.0.5
3
+ Version: 0.0.8
4
4
  Summary: A Python library for interacting with the yt-dlp-host API
5
5
  Author-email: "Amadeus (Wasys)" <tubik.corp@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/Vasysik/yt-dlp-host-api
@@ -50,7 +50,7 @@ print("Video info:", info_json)
50
50
 
51
51
  # Admin operations (requires admin API key)
52
52
  new_key = client.create_key("user_key", ["get_video", "get_audio", "get_info"])
53
- keys = client.list_keys()
53
+ keys = client.get_keys()
54
54
  key = client.get_key("user_key")
55
55
  client.delete_key("user_key")
56
56
  ```
@@ -93,7 +93,7 @@ client.delete_key("user_key")
93
93
  ### Admin
94
94
 
95
95
  - `client.create_key(name, permissions)`: Create a new API key
96
- - `client.list_keys()`: List all existing API keys
96
+ - `client.get_keys()`: List all existing API keys
97
97
  - `client.get_key(name)`: Get API key by key name
98
98
  - `client.delete_key(name)`: Delete an API key
99
99
 
@@ -0,0 +1,10 @@
1
+ yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
2
+ yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
3
+ yt_dlp_host_api/client.py,sha256=TDyzpKwhTqwi_Ob3oV3KCweZG-GDolPo6FFcdR_h0UE,3581
4
+ yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
5
+ yt_dlp_host_api/task.py,sha256=llgBAO_L1CajklMsbICdRpLdOV05Wi0oUh9NKj0bD0w,2674
6
+ yt_dlp_host_api-0.0.8.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
7
+ yt_dlp_host_api-0.0.8.dist-info/METADATA,sha256=I3nTkfbB2BVY9nStph5DrHVDQoLQ9JQdLItbYLCqnFA,3496
8
+ yt_dlp_host_api-0.0.8.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
9
+ yt_dlp_host_api-0.0.8.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
10
+ yt_dlp_host_api-0.0.8.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
2
- yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
3
- yt_dlp_host_api/client.py,sha256=KVhgabw4MLszYhjmWopW70QoyEvqDb-E_w7CVE0P87U,3430
4
- yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
5
- yt_dlp_host_api/task.py,sha256=aS96ZZik0rRiLwLx1mXm9GeF9lgEOOkCW-Qp-gHmgCo,2612
6
- yt_dlp_host_api-0.0.5.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
7
- yt_dlp_host_api-0.0.5.dist-info/METADATA,sha256=uOkAX7RJj1ecxlPACkLfU2BiTHVA8mtsIhOUg2cr2iY,3498
8
- yt_dlp_host_api-0.0.5.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
9
- yt_dlp_host_api-0.0.5.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
10
- yt_dlp_host_api-0.0.5.dist-info/RECORD,,