worqhat 0.0.1__py3-none-any.whl → 0.1.0a3__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.
Files changed (60) hide show
  1. worqhat/__init__.py +90 -10
  2. worqhat/_base_client.py +1992 -0
  3. worqhat/_client.py +467 -0
  4. worqhat/_compat.py +219 -0
  5. worqhat/_constants.py +14 -0
  6. worqhat/_exceptions.py +108 -0
  7. worqhat/_files.py +123 -0
  8. worqhat/_models.py +829 -0
  9. worqhat/_qs.py +150 -0
  10. worqhat/_resource.py +43 -0
  11. worqhat/_response.py +830 -0
  12. worqhat/_streaming.py +333 -0
  13. worqhat/_types.py +219 -0
  14. worqhat/_utils/__init__.py +57 -0
  15. worqhat/_utils/_logs.py +25 -0
  16. worqhat/_utils/_proxy.py +65 -0
  17. worqhat/_utils/_reflection.py +42 -0
  18. worqhat/_utils/_resources_proxy.py +24 -0
  19. worqhat/_utils/_streams.py +12 -0
  20. worqhat/_utils/_sync.py +86 -0
  21. worqhat/_utils/_transform.py +447 -0
  22. worqhat/_utils/_typing.py +151 -0
  23. worqhat/_utils/_utils.py +422 -0
  24. worqhat/_version.py +4 -0
  25. worqhat/lib/.keep +4 -0
  26. worqhat/resources/__init__.py +33 -0
  27. worqhat/resources/flows.py +223 -0
  28. worqhat/resources/health.py +143 -0
  29. worqhat/types/__init__.py +8 -0
  30. worqhat/types/flow_retrieve_metrics_params.py +25 -0
  31. worqhat/types/flow_retrieve_metrics_response.py +55 -0
  32. worqhat/types/health_check_response.py +33 -0
  33. worqhat/types/retrieve_server_info_response.py +15 -0
  34. worqhat-0.1.0a3.dist-info/METADATA +398 -0
  35. worqhat-0.1.0a3.dist-info/RECORD +38 -0
  36. {worqhat-0.0.1.dist-info → worqhat-0.1.0a3.dist-info}/WHEEL +1 -2
  37. {worqhat-0.0.1.dist-info → worqhat-0.1.0a3.dist-info/licenses}/LICENSE +201 -201
  38. worqhat/ai_models/__init__.py +0 -9
  39. worqhat/ai_models/ai_search.py +0 -41
  40. worqhat/ai_models/content_mod.py +0 -44
  41. worqhat/ai_models/image_analysis.py +0 -94
  42. worqhat/ai_models/image_gen.py +0 -281
  43. worqhat/ai_models/model_train.py +0 -45
  44. worqhat/ai_models/text_extract.py +0 -83
  45. worqhat/ai_models/text_gen.py +0 -177
  46. worqhat/database_management/Edit.py +0 -140
  47. worqhat/database_management/Read.py +0 -152
  48. worqhat/database_management/__init__.py +0 -5
  49. worqhat/database_management/collection.py +0 -25
  50. worqhat/test/test_ai_search.py +0 -38
  51. worqhat/test/test_content_mod.py +0 -39
  52. worqhat/test/test_image_analysis.py +0 -52
  53. worqhat/test/test_image_gen.py +0 -0
  54. worqhat/test/test_model_train.py +0 -52
  55. worqhat/test/test_text_extract.py +0 -65
  56. worqhat/test/test_text_gen.py +0 -66
  57. worqhat-0.0.1.dist-info/METADATA +0 -18
  58. worqhat-0.0.1.dist-info/RECORD +0 -26
  59. worqhat-0.0.1.dist-info/top_level.txt +0 -1
  60. /worqhat/{test/__init__.py → py.typed} +0 -0
@@ -1,281 +0,0 @@
1
- import requests
2
- import os
3
-
4
-
5
- def generate_image_v2(prompt="", image_style="realistic", output_type="url", orientation="square", api_key=None):
6
- if not api_key:
7
- api_key = os.getenv("API_KEY")
8
- if not api_key:
9
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
10
- url = "https://api.worqhat.com/api/ai/images/generate/v2"
11
- headers = {
12
- "Authorization": "Bearer " + api_key,
13
- "Content-Type": "application/json"
14
- }
15
- payload = {
16
- "prompt": prompt,
17
- "image_style": image_style,
18
- "output_type": output_type,
19
- "orientation": orientation
20
- }
21
- response = requests.post(url, json=payload, headers=headers)
22
- return response.text
23
-
24
- def generate_image_v3(prompt="", image_style="realistic", output_type="url", orientation="square", api_key=None):
25
- if not api_key:
26
- api_key = os.getenv("API_KEY")
27
-
28
- if not api_key:
29
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
30
- url = "https://api.worqhat.com/api/ai/images/generate/v3"
31
- headers = {
32
- "Authorization": "Bearer " + api_key,
33
- "Content-Type": "application/json"
34
- }
35
- payload = {
36
- "prompt": prompt,
37
- "image_style": image_style,
38
- "output_type": output_type,
39
- "orientation": orientation
40
- }
41
- response = requests.post(url, json=payload, headers=headers)
42
- return response.text
43
-
44
- def modify_image_v2(image=None,modification=None, output_type="URL", similarity="30", api_key=None):
45
- if not modification:
46
- return "Modification description is missing"
47
- if not image or len(image) == 0:
48
- return "Image is missing"
49
- if not api_key:
50
- api_key = os.getenv("API_KEY")
51
- if not api_key:
52
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
53
- url = "https://api.worqhat.com/api/ai/images/modify/v2"
54
- headers = {
55
- "Authorization": f"Bearer {api_key}"
56
- }
57
- payload = {
58
- "modification": modification,
59
- "output_type": output_type,
60
- "similarity": similarity
61
- }
62
- if image.startswith('http://') or image.startswith('https://'):
63
- response = requests.get(image)
64
- files = [('existing_image', ('file', response.content, 'application/octet-stream'))]
65
- else:
66
- with open(image, 'rb') as f:
67
- files = [('existing_image', ('file', f, 'application/octet-stream'))]
68
- response = requests.post(url, headers=headers, data=payload, files=files)
69
- return response.text
70
-
71
-
72
- def modify_image_v3(image=None,modification=None, output_type="URL", similarity="30", api_key=None):
73
- if not modification:
74
- return "Modification description is missing"
75
- if not image or len(image) == 0:
76
- return "Existing images are missing"
77
- if not api_key:
78
- api_key = os.getenv("API_KEY")
79
-
80
- # If api_key is still not available, return an error message
81
- if not api_key:
82
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
83
-
84
- url = "https://api.worqhat.com/api/ai/images/modify/v3"
85
- headers = {
86
- "Authorization": f"Bearer {api_key}"
87
- }
88
-
89
-
90
-
91
- # Prepare payload
92
- payload = {
93
- "modification": modification,
94
- "output_type": output_type,
95
- "similarity": similarity
96
- }
97
-
98
- # Prepare files data in the required format
99
- if image.startswith('http://') or image.startswith('https://'):
100
- # If image is a URL, download the image content
101
- response = requests.get(image)
102
- files = [('existing_image', ('file', response.content, 'application/octet-stream'))]
103
- else:
104
- # If image is a local file path, read the file content
105
- with open(image, 'rb') as f:
106
- files = [('existing_image', ('file', f, 'application/octet-stream'))]
107
-
108
- # Make the API call
109
- response = requests.post(url, headers=headers, data=payload, files=files)
110
- return response.text
111
-
112
- def remove_text_from_image(image=None,output_type="URL", api_key=None):
113
-
114
- if not image:
115
- return "Existing image is missing"
116
- if not api_key:
117
- api_key = os.getenv("API_KEY")
118
- if not api_key:
119
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
120
- url = "https://api.worqhat.com/api/ai/images/modify/v3/remove-text"
121
- headers = {
122
- "Authorization": f"Bearer {api_key}"
123
- }
124
-
125
- payload = {'output_type': output_type}
126
-
127
- if image.startswith('http://') or image.startswith('https://'):
128
- response = requests.get(image)
129
- files = [('existing_image', ('file', response.content, 'image/png'))]
130
- else:
131
- with open(image, 'rb') as f:
132
- files = [('existing_image', ('file', f, 'image/png'))]
133
-
134
- response = requests.post(url, headers=headers, data=payload, files=files)
135
- return response.text
136
-
137
- def remove_background_from_image(existing_image=None,output_type="URL", api_key=None):
138
- if not existing_image:
139
- return "Existing image is missing"
140
- if not api_key:
141
- api_key = os.getenv("API_KEY")
142
- if not api_key:
143
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
144
-
145
- url = "https://api.worqhat.com/api/ai/images/modify/v3/remove-background"
146
- headers = {
147
- "Authorization": f"Bearer {api_key}"
148
- }
149
- payload = {'output_type': output_type}
150
- if existing_image.startswith('http://') or existing_image.startswith('https://'):
151
- response = requests.get(existing_image)
152
- files = [('existing_image', ('file', response.content, 'image/png'))]
153
- else:
154
- with open(existing_image, 'rb') as f:
155
- files = [('existing_image', ('file', f, 'image/png'))]
156
- response = requests.post(url, headers=headers, data=payload, files=files)
157
- return response.text
158
-
159
- def replace_background(image=None,modification=None, output_type="URL", api_key=None):
160
- if not modification:
161
- return "Modification description is missing"
162
- if not image:
163
- return "Existing image is missing"
164
- if not api_key:
165
- api_key = os.getenv("API_KEY")
166
- if not api_key:
167
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
168
-
169
- url = "https://api.worqhat.com/api/ai/images/modify/v3/replace-background"
170
- headers = {
171
- "Authorization": f"Bearer {api_key}"
172
- }
173
-
174
- payload = {
175
- "modification": modification,
176
- "output_type": output_type
177
- }
178
-
179
- if image.startswith('http://') or image.startswith('https://'):
180
- response = requests.get(image)
181
- files = [('existing_image', ('file', response.content, 'image/png'))]
182
- else:
183
- with open(image, 'rb') as f:
184
- files = [('existing_image', ('file', f, 'image/png'))]
185
- response = requests.post(url, headers=headers, data=payload, files=files)
186
- return response.text
187
-
188
- def search_replace_image(image=None,modification=None, output_type="URL", search_object=None, api_key=None):
189
- if not modification:
190
- return "Modification description is missing"
191
- if not search_object:
192
- return "Search object description is missing"
193
- if not image:
194
- return "Existing image is missing"
195
- if not api_key:
196
- api_key = os.getenv("API_KEY")
197
- if not api_key:
198
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
199
- url = "https://api.worqhat.com/api/ai/images/modify/v3/search-replace-image"
200
- headers = {
201
- "Authorization": f"Bearer {api_key}"
202
- }
203
- payload = {
204
- "modification": modification,
205
- "output_type": output_type,
206
- "search_object": search_object
207
- }
208
-
209
- if image.startswith('http://') or image.startswith('https://'):
210
-
211
- response = requests.get(image)
212
- files = [('existing_image', ('file', response.content, 'image/png'))]
213
- else:
214
-
215
- with open(image, 'rb') as f:
216
- files = [('existing_image', ('file', f, 'image/png'))]
217
- response = requests.post(url, headers=headers, data=payload, files=files)
218
- return response.text
219
-
220
-
221
- def extend_image(image=None,output_type="URL", left_extend="100", right_extend="100", top_extend="50", bottom_extend="50", description="", api_key=None):
222
- if not image:
223
- return "image is missing"
224
- if not api_key:
225
- api_key = os.getenv("API_KEY")
226
- if not api_key:
227
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
228
-
229
- url = "https://api.worqhat.com/api/ai/images/modify/v3/extend-image"
230
- headers = {
231
- "Authorization": f"Bearer {api_key}"
232
- }
233
-
234
- payload = {
235
- "output_type": output_type,
236
- "leftExtend": left_extend,
237
- "rightExtend": right_extend,
238
- "topExtend": top_extend,
239
- "bottomExtend": bottom_extend,
240
- "description": description
241
- }
242
-
243
- if image.startswith('http://') or image.startswith('https://'):
244
-
245
- response = requests.get(image)
246
- files = [('existing_image', ('file', response.content, 'image/png'))]
247
- else:
248
- with open(image, 'rb') as f:
249
- files = [('existing_image', ('file', f, 'image/png'))]
250
-
251
- response = requests.post(url, headers=headers, data=payload, files=files)
252
- return response.text
253
-
254
- def upscale_image(existing_image=None,scale="4", output_type="URL",api_key=None):
255
- if not existing_image:
256
- return "Existing image is missing"
257
- if not api_key:
258
- api_key = os.getenv("API_KEY")
259
- if not api_key:
260
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
261
-
262
- url = "https://api.worqhat.com/api/ai/images/upscale/v3"
263
- headers = {
264
- "Authorization": f"Bearer {api_key}"
265
- }
266
- payload = {
267
- "scale": scale,
268
- "output_type": output_type
269
- }
270
-
271
- if existing_image.startswith('http://') or existing_image.startswith('https://'):
272
-
273
- response = requests.get(existing_image)
274
- files = [('existing_image', ('file', response.content, 'image/png'))]
275
- else:
276
- with open(existing_image, 'rb') as f:
277
- files = [('existing_image', ('file', f, 'image/png'))]
278
-
279
- response = requests.post(url, headers=headers, data=payload, files=files)
280
-
281
- return response.text
@@ -1,45 +0,0 @@
1
- import requests
2
- import os
3
-
4
-
5
- def list_datasets(api_key=None):
6
- if not api_key:
7
- api_key = os.getenv("API_KEY")
8
- if not api_key:
9
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
10
- url = "https://api.worqhat.com/api/list-datasets"
11
- headers = {"Authorization": "Bearer " + api_key}
12
- response = requests.post(url, headers=headers)
13
- return response.text
14
-
15
- def delete_dataset(dataset_id="", api_key=None):
16
- if dataset_id=="":
17
- raise ValueError("No Dataset Id provided")
18
- if not api_key:
19
- api_key = os.getenv("API_KEY")
20
- if not api_key:
21
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
22
- url = f"https://api.worqhat.com/api/delete-datasets/{dataset_id}"
23
- headers = {"Authorization": "Bearer " + api_key}
24
- response = requests.post(url, headers=headers)
25
- return response.text
26
-
27
-
28
- def train_dataset(dataset_id="", dataset_name="", dataset_type="", json_data="", training_file=None, api_key=None):
29
- if dataset_id=="":
30
- raise ValueError("No Dataset Id provided")
31
- if not api_key:
32
- api_key = os.getenv("API_KEY")
33
- if not api_key:
34
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
35
- url = "https://api.worqhat.com/api/ai/datasets/train-datasets"
36
- headers = {"Authorization": "Bearer " + api_key}
37
- payload = {
38
- "datasetId": dataset_id,
39
- "dataset_name": dataset_name,
40
- "dataset_type": dataset_type,
41
- "json_data": (None, json_data),
42
- "training_file": (training_file, open(training_file, 'rb'))
43
- }
44
- response = requests.post(url, files=payload, headers=headers)
45
- return response.text
@@ -1,83 +0,0 @@
1
- import requests
2
- import os
3
-
4
-
5
- def extract_pdf_text(pdf_file=None, api_key=None):
6
- if not pdf_file:
7
- return "PDF file is missing"
8
- if not api_key:
9
- api_key = os.getenv("API_KEY")
10
- print(api_key)
11
- if not api_key:
12
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
13
- url = "https://api.worqhat.com/api/ai/v2/pdf-extract"
14
- headers = {
15
- "Authorization": f"Bearer {api_key}"
16
- }
17
- files = [('file', (os.path.basename(pdf_file), open(pdf_file, 'rb'), 'application/pdf'))]
18
- response = requests.post(url, files=files, headers=headers)
19
- return response.text
20
-
21
- def web_extract(url_search="", headline=True, inline_code=True, code_blocks=True, references=True, tables=True, api_key=None):
22
- if url_search=="":
23
- raise ValueError("No URL provided")
24
- if not api_key:
25
- api_key = os.getenv("API_KEY")
26
- if not api_key:
27
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
28
- url = "https://api.worqhat.com/api/ai/v2/web-extract"
29
- headers = {
30
- "Authorization": "Bearer " + api_key,
31
- "Content-Type": "application/json"
32
- }
33
- payload = {
34
- "url_path": url_search,
35
- "headline": headline,
36
- "inline_code": inline_code,
37
- "code_blocks": code_blocks,
38
- "references": references,
39
- "tables": tables
40
- }
41
- response = requests.post(url, json=payload, headers=headers)
42
- return response.text
43
-
44
-
45
- def detect_image_text(image=None, output_type="text", api_key=None):
46
-
47
- if not image or len(image) == 0:
48
- raise ValueError("Images are missing")
49
- if not api_key:
50
- api_key = os.getenv("API_KEY")
51
- if not api_key:
52
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
53
- url = "https://api.worqhat.com/api/ai/images/v2/image-text-detection"
54
- headers = {
55
- "Authorization": f"Bearer {api_key}"
56
- }
57
- results = []
58
- payload = {'output_type': output_type}
59
- if image.startswith('http://') or image.startswith('https://'):
60
- response = requests.get(image)
61
- files = [('image', (os.path.basename(image), response.content, 'image/jpeg'))]
62
- else:
63
- with open(image, 'rb') as f:
64
- files = [('image', (os.path.basename(image), f, 'image/jpeg'))]
65
- response = requests.post(url, headers=headers, data=payload, files=files)
66
- results.append(response.text)
67
- return results
68
-
69
-
70
- def convert_speech_to_text(audio_file=None, api_key=None):
71
- if not audio_file:
72
- raise ValueError("Audio file is missing")
73
- if not api_key:
74
- api_key = os.getenv("API_KEY")
75
- if not api_key:
76
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
77
- url = "https://api.worqhat.com/api/ai/speech-text"
78
- headers = {
79
- "Authorization": f"Bearer {api_key}"
80
- }
81
- files = [('audio', (os.path.basename(audio_file), open(audio_file, 'rb'), 'application/octet-stream'))]
82
- response = requests.post(url, files=files, headers=headers)
83
- return response.text
@@ -1,177 +0,0 @@
1
- import requests
2
- import json
3
- import os
4
- def get_ai_response_v2(question="",
5
- preserve_history=False,
6
- randomness=0.5,
7
- stream_data=False,
8
- conversation_history=[],
9
- training_data="",
10
- response_type="text",
11
- api_key=None):
12
- url = "https://api.worqhat.com/api/ai/content/v2"
13
-
14
- payload = {
15
- "question": question,
16
- "preserve_history": preserve_history,
17
- "randomness": randomness,
18
- "stream_data": stream_data,
19
- "conversation_history": conversation_history,
20
- "training_data": training_data,
21
- "response_type": response_type
22
- }
23
-
24
- headers = {"Content-Type": "application/json"}
25
-
26
- if not api_key:
27
- api_key = os.getenv("API_KEY")
28
-
29
- if api_key:
30
- headers["Authorization"] = "Bearer " + api_key
31
- else:
32
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
33
-
34
- response = requests.post(url, json=payload, headers=headers, stream=stream_data)
35
-
36
- if stream_data:
37
- for line in response.iter_lines():
38
- if line:
39
- if line.startswith(b'data:'):
40
- json_content = line[len(b'data:'):].decode('utf-8').strip()
41
- print(json_content)
42
- else:
43
- json_response = response.text
44
- try:
45
- json_data = json.loads(json_response)
46
- return(json.dumps(json_data, indent=4))
47
- except json.JSONDecodeError:
48
- print(json_response)
49
-
50
-
51
- def get_ai_response_v3(question="",
52
- preserve_history=False,
53
- randomness=0.5,
54
- stream_data=False,
55
- conversation_history=[],
56
- training_data="",
57
- response_type="text",
58
- api_key=None):
59
- url = "https://api.worqhat.com/api/ai/content/v3"
60
-
61
- payload = {
62
- "question": question,
63
- "preserve_history": preserve_history,
64
- "randomness": randomness,
65
- "stream_data": stream_data,
66
- "conversation_history": conversation_history,
67
- "training_data": training_data,
68
- "response_type": response_type
69
- }
70
-
71
- headers = {"Content-Type": "application/json"}
72
-
73
- if not api_key:
74
- api_key = os.getenv("API_KEY")
75
-
76
- if api_key:
77
- headers["Authorization"] = "Bearer " + api_key
78
- else:
79
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
80
-
81
- response = requests.post(url, json=payload, headers=headers, stream=stream_data)
82
-
83
- if stream_data:
84
- for line in response.iter_lines():
85
- if line:
86
- if line.startswith(b'data:'):
87
- json_content = line[len(b'data:'):].decode('utf-8').strip()
88
- print(json_content)
89
- else:
90
- json_response = response.text
91
- try:
92
- json_data = json.loads(json_response)
93
- print(json.dumps(json_data, indent=4))
94
- except json.JSONDecodeError:
95
- print(json_response)
96
-
97
-
98
- def get_alpha_ai_response(question="",
99
- preserve_history=False,
100
- randomness=0.5,
101
- stream_data=False,
102
- conversation_history=[],
103
- training_data="",
104
- response_type="text",
105
- api_key=None):
106
- url = "https://api.worqhat.com/api/ai/content/v3/alpha"
107
- payload = {
108
- "question": question,
109
- "preserve_history": preserve_history,
110
- "randomness": randomness,
111
- "stream_data": stream_data,
112
- "conversation_history": conversation_history,
113
- "training_data": training_data,
114
- "response_type": response_type
115
- }
116
- headers = {"Content-Type": "application/json"}
117
- if not api_key:
118
- api_key = os.getenv("API_KEY")
119
- if api_key:
120
- headers["Authorization"] = "Bearer " + api_key
121
- else:
122
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
123
- response = requests.request("POST",url, json=payload, headers=headers)
124
- if stream_data:
125
- for line in response.iter_lines():
126
- if line:
127
- if line.startswith(b'data:'):
128
- json_content = line[len(b'data:'):].decode('utf-8').strip()
129
- print(json_content)
130
- else:
131
- json_response = response.text
132
- try:
133
- json_data = json.loads(json_response)
134
- print(json.dumps(json_data, indent=4))
135
- except json.JSONDecodeError:
136
- print(json_response)
137
-
138
-
139
- def get_large_ai_response_v2(question="",
140
- dataset_id="",
141
- preserve_history=True,
142
- randomness=0.5,
143
- stream_data=False,
144
- conversation_history=[],
145
- instructions=None,
146
- api_key=None):
147
- url = "https://api.worqhat.com/api/ai/content/v2-large/answering"
148
- payload = {
149
- "question": question,
150
- "datasetId": dataset_id,
151
- "preserve_history": preserve_history,
152
- "randomness": randomness,
153
- "stream_data": stream_data,
154
- "conversation_history": conversation_history,
155
- "instructions": instructions
156
- }
157
- headers = {"Content-Type": "application/json"}
158
- if not api_key:
159
- api_key = os.getenv("API_KEY")
160
- if api_key:
161
- headers["Authorization"] = "Bearer " + api_key
162
- else:
163
- raise ValueError("API key is missing. Provide it as an argument or in the .env file.")
164
- response = requests.request("POST",url, json=payload, headers=headers)
165
- if stream_data:
166
- for line in response.iter_lines():
167
- if line:
168
- if line.startswith(b'data:'):
169
- json_content = line[len(b'data:'):].decode('utf-8').strip()
170
- print(json_content)
171
- else:
172
- json_response = response.text
173
- try:
174
- json_data = json.loads(json_response)
175
- print(json.dumps(json_data, indent=4))
176
- except json.JSONDecodeError:
177
- print(json_response)