mixpeek 0.6.23__py3-none-any.whl → 0.6.25__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.
@@ -16,12 +16,13 @@ class Connections:
16
16
  response = requests.post(url, json=data, headers=self.headers)
17
17
  return response.json()
18
18
 
19
+ # mixpeek.connections.data.insert(connection_id="123", payload={"key": "value"})
19
20
  class Data:
20
21
  def __init__(self, parent):
21
22
  self.base_url = parent.base_url
22
23
  self.headers = parent.headers
23
24
 
24
- def insert(self, connection_id: str, payload: dict):
25
+ def insert(self, connection_id: str, payload: list):
25
26
  pass
26
27
 
27
28
  def delete(self, connection_id: str, filters: dict):
@@ -5,6 +5,16 @@ class Pipelines:
5
5
  self.base_url = base_url
6
6
  self.headers = headers
7
7
 
8
+ # mixpeek.pipelines.enable
9
+ def enable(self, pipeline_id: str, enable: bool):
10
+ url = f"{self.base_url}pipelines/{pipeline_id}/enable"
11
+ data = {
12
+ "enable": enable
13
+ }
14
+ response = requests.patch(url, json=data, headers=self.headers)
15
+ return response.json()
16
+
17
+ # mixpeek.pipelines.create
8
18
  def create(self, alias: str, code: str, destination: dict, source: dict):
9
19
  url = f"{self.base_url}pipelines/"
10
20
  data = {
@@ -16,6 +26,7 @@ class Pipelines:
16
26
  response = requests.post(url, json=data, headers=self.headers)
17
27
  return response.json()
18
28
 
29
+ # mixpeek.pipelines.invoke
19
30
  def invoke(self, pipeline_id: str, payload: dict, options: dict):
20
31
  url = f"{self.base_url}pipelines/invoke/{pipeline_id}"
21
32
  data = {
@@ -1,4 +1,49 @@
1
1
  import requests
2
+ from magika import Magika
3
+
4
+
5
+ modality_to_content_types = {
6
+ "text": [
7
+ "application/pdf",
8
+ "text/html",
9
+ "text/html; charset=utf-8",
10
+ "text/csv",
11
+ "text/plain",
12
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
13
+ "application/vnd.ms-powerpoint",
14
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
15
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
16
+ "text/plain",
17
+ "text/markdown",
18
+ "application/xml",
19
+ ],
20
+ "image": [
21
+ "image/png",
22
+ "image/jpeg",
23
+ "image/gif",
24
+ "image/bmp",
25
+ "image/tiff",
26
+ "image/webp",
27
+ ],
28
+ "audio": [
29
+ "audio/mpeg",
30
+ "audio/wav",
31
+ "audio/ogg",
32
+ "audio/flac",
33
+ "audio/mp4",
34
+ "audio/aac",
35
+ "audio/mp3",
36
+ ],
37
+ "video": [
38
+ "video/mp4",
39
+ "video/x-msvideo",
40
+ "video/quicktime",
41
+ "video/x-ms-wmv",
42
+ "video/x-flv",
43
+ ],
44
+ }
45
+
46
+
2
47
 
3
48
  class Tools:
4
49
  def __init__(self, base_url, headers):
@@ -6,6 +51,17 @@ class Tools:
6
51
  self.headers = headers
7
52
  self.video = self.Video(self)
8
53
 
54
+ def detect(self, url: str):
55
+ # Fetch the file from the URL
56
+ response = requests.get(url)
57
+ content_type = response.headers.get('Content-Type', '').split(';')[0] # Get the base MIME type without parameters
58
+
59
+ # Determine modality based on MIME type and Magika detection
60
+ for modality, types in modality_to_content_types.items():
61
+ if content_type in types:
62
+ return modality
63
+ return 'unknown'
64
+
9
65
  class Video:
10
66
  def __init__(self, parent):
11
67
  self.base_url = parent.base_url
@@ -17,7 +73,7 @@ class Tools:
17
73
  "url": url,
18
74
  "frame_interval": frame_interval,
19
75
  "resolution": resolution,
20
- "use_base64": return_base64
76
+ "return_base64": return_base64
21
77
  }
22
78
  response = requests.post(endpoint, json=data, headers=self.headers)
23
79
  return response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mixpeek
3
- Version: 0.6.23
3
+ Version: 0.6.25
4
4
  Summary: Mixpeek Python SDK
5
5
  Home-page: https://github.com/mixpeek/mixpeek-python
6
6
  Author: Ethan Steininger
@@ -2,13 +2,13 @@ mixpeek/__init__.py,sha256=XDdcK7wTEOEcF1cp-GeWmgPJ21Ny1R9pB0PPNrdDTMo,28
2
2
  mixpeek/client.py,sha256=aZ6zzSrqbV3RxD2G-W0Aqy06QWDfRux_0DfLr-awdG0,895
3
3
  mixpeek/exceptions.py,sha256=Orhdo5UFLn3fcWVJtlgkznW8Iy5ndL96h0qTY8zOlDA,235
4
4
  mixpeek/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- mixpeek/endpoints/connections.py,sha256=ctzbdZV7ophrYOSqfHne0HE3sxxRXOep00qcujE0NKs,832
5
+ mixpeek/endpoints/connections.py,sha256=-SdwLhHY1KNnNT9u_V2hx0kiKjYrDXKLzceedZBqa14,917
6
6
  mixpeek/endpoints/embed.py,sha256=8ds_FinxZRW-ZQyv6LjDAX6Zoek2Cv4OYhwIgSBqwTs,1598
7
7
  mixpeek/endpoints/extract.py,sha256=1KWxvgbQanRwYcFPWGthyv32LVj2gAhxDERwY3QgHUg,476
8
8
  mixpeek/endpoints/generate.py,sha256=SFjVYfgeuIt4wO0I5ItnB4TEHhRkLgZOvQfWlEioye8,594
9
- mixpeek/endpoints/pipelines.py,sha256=HgU00smP4guE0Qf601Up2mk9LqTimg4Dg27kkhE_H-Q,840
10
- mixpeek/endpoints/tools.py,sha256=Yw6mvBqbrREY79l_BM6ek_CjxDPbFUdkmZqiaZcYSe8,787
11
- mixpeek-0.6.23.dist-info/METADATA,sha256=qL5Nyo5TKlk0rKXA_4ZYi8TBIC55xseXT4Jssy-h9yo,1952
12
- mixpeek-0.6.23.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- mixpeek-0.6.23.dist-info/top_level.txt,sha256=EJ8Jc4IhqyUwnUlBwKbs498Ju4O9a-IDh2kXc_lo6Vg,8
14
- mixpeek-0.6.23.dist-info/RECORD,,
9
+ mixpeek/endpoints/pipelines.py,sha256=X2mRsWgOx6FgWbInrAdjLQJbjXjorNqAo9mjFawLpoE,1210
10
+ mixpeek/endpoints/tools.py,sha256=R86aFUZDGFzVL8AHEqJHiZM5TQWt6lKlxdf9_s6w1OQ,2289
11
+ mixpeek-0.6.25.dist-info/METADATA,sha256=INDNupXayci0bapoCqE8Ig9ZMSZmJ5JLI3QstnUBdiU,1952
12
+ mixpeek-0.6.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ mixpeek-0.6.25.dist-info/top_level.txt,sha256=EJ8Jc4IhqyUwnUlBwKbs498Ju4O9a-IDh2kXc_lo6Vg,8
14
+ mixpeek-0.6.25.dist-info/RECORD,,