yt-dlp-host-api 0.0.3__py3-none-any.whl → 0.0.4__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 +25 -23
- {yt_dlp_host_api-0.0.3.dist-info → yt_dlp_host_api-0.0.4.dist-info}/METADATA +10 -7
- {yt_dlp_host_api-0.0.3.dist-info → yt_dlp_host_api-0.0.4.dist-info}/RECORD +6 -6
- {yt_dlp_host_api-0.0.3.dist-info → yt_dlp_host_api-0.0.4.dist-info}/LICENSE +0 -0
- {yt_dlp_host_api-0.0.3.dist-info → yt_dlp_host_api-0.0.4.dist-info}/WHEEL +0 -0
- {yt_dlp_host_api-0.0.3.dist-info → yt_dlp_host_api-0.0.4.dist-info}/top_level.txt +0 -0
yt_dlp_host_api/client.py
CHANGED
@@ -25,6 +25,31 @@ class Client:
|
|
25
25
|
if response.status_code != 200:
|
26
26
|
return False
|
27
27
|
return True
|
28
|
+
|
29
|
+
def create_key(self, name, permissions):
|
30
|
+
data = {"name": name, "permissions": permissions}
|
31
|
+
response = requests.post(f"{self.host_url}/create_key", json=data, headers=self.headers)
|
32
|
+
if response.status_code != 201:
|
33
|
+
raise APIError(response.json().get('error', 'Unknown error'))
|
34
|
+
return response.json()
|
35
|
+
|
36
|
+
def delete_key(self, name):
|
37
|
+
response = requests.delete(f"{self.host_url}/delete_key/{name}", headers=self.headers)
|
38
|
+
if response.status_code != 200:
|
39
|
+
raise APIError(response.json().get('error', 'Unknown error'))
|
40
|
+
return response.json()
|
41
|
+
|
42
|
+
def get_key(self, name):
|
43
|
+
response = requests.delete(f"{self.host_url}/get_key/{name}", headers=self.headers)
|
44
|
+
if response.status_code != 200:
|
45
|
+
raise APIError(response.json().get('error', 'Unknown error'))
|
46
|
+
return response.json()
|
47
|
+
|
48
|
+
def list_keys(self):
|
49
|
+
response = requests.get(f"{self.host_url}/list_keys", headers=self.headers)
|
50
|
+
if response.status_code != 200:
|
51
|
+
raise APIError(response.json().get('error', 'Unknown error'))
|
52
|
+
return response.json()
|
28
53
|
|
29
54
|
class SendTask:
|
30
55
|
def __init__(self, client):
|
@@ -50,26 +75,3 @@ class Client:
|
|
50
75
|
if response.status_code != 200:
|
51
76
|
raise APIError(response.json().get('error', 'Unknown error'))
|
52
77
|
return Task(self.client, response.json()['task_id'], 'get_info')
|
53
|
-
|
54
|
-
class Admin:
|
55
|
-
def __init__(self, client):
|
56
|
-
self.client = client
|
57
|
-
|
58
|
-
def create_key(self, name, permissions):
|
59
|
-
data = {"name": name, "permissions": permissions}
|
60
|
-
response = requests.post(f"{self.client.host_url}/create_key", json=data, headers=self.client.headers)
|
61
|
-
if response.status_code != 201:
|
62
|
-
raise APIError(response.json().get('error', 'Unknown error'))
|
63
|
-
return response.json()
|
64
|
-
|
65
|
-
def delete_key(self, name):
|
66
|
-
response = requests.delete(f"{self.client.host_url}/delete_key/{name}", headers=self.client.headers)
|
67
|
-
if response.status_code != 200:
|
68
|
-
raise APIError(response.json().get('error', 'Unknown error'))
|
69
|
-
return response.json()
|
70
|
-
|
71
|
-
def list_keys(self):
|
72
|
-
response = requests.get(f"{self.client.host_url}/list_keys", headers=self.client.headers)
|
73
|
-
if response.status_code != 200:
|
74
|
-
raise APIError(response.json().get('error', 'Unknown error'))
|
75
|
-
return response.json()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: yt_dlp_host_api
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
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
|
@@ -49,9 +49,10 @@ info_json = client.get_info(url='https://youtu.be/1FPdtR_5KFo').get_json(['quali
|
|
49
49
|
print("Video info:", info_json)
|
50
50
|
|
51
51
|
# Admin operations (requires admin API key)
|
52
|
-
new_key = client.
|
53
|
-
keys = client.
|
54
|
-
client.
|
52
|
+
new_key = client.create_key("user_key", ["get_video", "get_audio", "get_info"])
|
53
|
+
keys = client.list_keys()
|
54
|
+
key = client.get_key("user_key")
|
55
|
+
client.delete_key("user_key")
|
55
56
|
```
|
56
57
|
|
57
58
|
## Features
|
@@ -62,6 +63,7 @@ client.admin.delete_key("user_key")
|
|
62
63
|
- Admin operations:
|
63
64
|
- Create new API keys
|
64
65
|
- List existing API keys
|
66
|
+
- Get API key by key name
|
65
67
|
- Delete API keys
|
66
68
|
|
67
69
|
## API Reference
|
@@ -90,9 +92,10 @@ client.admin.delete_key("user_key")
|
|
90
92
|
|
91
93
|
### Admin
|
92
94
|
|
93
|
-
- `client.
|
94
|
-
- `client.
|
95
|
-
- `client.
|
95
|
+
- `client.create_key(name, permissions)`: Create a new API key
|
96
|
+
- `client.list_keys()`: List all existing API keys
|
97
|
+
- `client.get_key(name)`: Get API key by key name
|
98
|
+
- `client.delete_key(name)`: Delete an API key
|
96
99
|
|
97
100
|
## Error Handling
|
98
101
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
yt_dlp_host_api/__init__.py,sha256=RHx1BvH2Cy_dweEKo5sA-hdBOfBdY_2ds7srPuKGzWQ,41
|
2
2
|
yt_dlp_host_api/api.py,sha256=iLzWKoyiXeu0Y1Uky8PzpxxHTSMcTGzxlCRT121AKcM,196
|
3
|
-
yt_dlp_host_api/client.py,sha256=
|
3
|
+
yt_dlp_host_api/client.py,sha256=VeaFlLL3ryS3BnOTP-uudgzSQ94U2LrXT_dO4YJ60JI,3469
|
4
4
|
yt_dlp_host_api/exceptions.py,sha256=U_70W1R_ZcUfKptUShGB5VPWQXwc5M29_sNC8pwwq8g,38
|
5
5
|
yt_dlp_host_api/task.py,sha256=aS96ZZik0rRiLwLx1mXm9GeF9lgEOOkCW-Qp-gHmgCo,2612
|
6
|
-
yt_dlp_host_api-0.0.
|
7
|
-
yt_dlp_host_api-0.0.
|
8
|
-
yt_dlp_host_api-0.0.
|
9
|
-
yt_dlp_host_api-0.0.
|
10
|
-
yt_dlp_host_api-0.0.
|
6
|
+
yt_dlp_host_api-0.0.4.dist-info/LICENSE,sha256=-_Ad_xue4UymJ8jO-ZsSg0vmZ6SUm8WYdoEwHLyBUlc,1078
|
7
|
+
yt_dlp_host_api-0.0.4.dist-info/METADATA,sha256=y2ZLG6g5XRcZUYo194M1Q90ShKZSAS90m5y0CjFsPfI,3498
|
8
|
+
yt_dlp_host_api-0.0.4.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
9
|
+
yt_dlp_host_api-0.0.4.dist-info/top_level.txt,sha256=Mn3FZuqLCHr47sRjhtEOz7lDl4lpsHkymWANORYp72s,16
|
10
|
+
yt_dlp_host_api-0.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|