mixpeek 0.6.27__tar.gz → 0.6.29__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mixpeek
3
- Version: 0.6.27
3
+ Version: 0.6.29
4
4
  Summary: Mixpeek Python SDK
5
5
  Home-page: https://github.com/mixpeek/mixpeek-python
6
6
  Author: Ethan Steininger
@@ -101,6 +101,15 @@ mixpeek.connections.data.delete(
101
101
  )
102
102
  ```
103
103
 
104
+ Upload file
105
+
106
+ ```python
107
+ mixpeek.connections.storage.upload(
108
+ connection_id="conn_321",
109
+ file_path="/my/local/file.mp4"
110
+ )
111
+ ```
112
+
104
113
  ### Tools
105
114
 
106
115
  ```python
@@ -86,6 +86,15 @@ mixpeek.connections.data.delete(
86
86
  )
87
87
  ```
88
88
 
89
+ Upload file
90
+
91
+ ```python
92
+ mixpeek.connections.storage.upload(
93
+ connection_id="conn_321",
94
+ file_path="/my/local/file.mp4"
95
+ )
96
+ ```
97
+
89
98
  ### Tools
90
99
 
91
100
  ```python
@@ -19,6 +19,8 @@ class Mixpeek:
19
19
  self.extract = Extract(self.base_url, self.headers)
20
20
  self.embed = Embed(self.base_url, self.headers)
21
21
  self.generate = Generate(self.base_url, self.headers)
22
- self.connections = Connections(self.base_url, self.headers)
22
+
23
+ # we include api_key as well because the header is different for upload
24
+ self.connections = Connections(self.base_url, self.headers, self.api_key)
23
25
  self.tools = Tools(self.base_url, self.headers)
24
26
  self.pipelines = Pipelines(self.base_url, self.headers)
@@ -0,0 +1,71 @@
1
+ import requests
2
+ import os
3
+
4
+ class Connections:
5
+ def __init__(self, base_url, headers, api_key):
6
+ self.base_url = base_url
7
+ self.headers = headers
8
+ self.api_key = api_key
9
+ self.data = self.Data(self)
10
+ self.storage = self.Storage(self)
11
+
12
+ def create(self, alias: str, engine: str, details: dict):
13
+ url = f"{self.base_url}connections/"
14
+ data = {
15
+ "alias": alias,
16
+ "engine": engine,
17
+ "details": details
18
+ }
19
+ response = requests.post(url, json=data, headers=self.headers)
20
+ return response.json()
21
+
22
+ class Data:
23
+ def __init__(self, parent):
24
+ self.base_url = parent.base_url
25
+ self.headers = parent.headers
26
+
27
+ # mixpeek.connections.data.insert(connection_id="123", payload={"key": "value"})
28
+ def insert(self, connection_id: str, payload: list):
29
+ pass
30
+
31
+ # mixpeek.connections.data.delete(connection_id="123", filters={"key": "value"})
32
+ def delete(self, connection_id: str, filters: dict):
33
+ pass
34
+
35
+ # mixpeek.connections.data.upsert(connection_id="123", payload={"key": "value"}, filters={"key": "value"})
36
+ def upsert(self, connection_id: str, payload: dict, filters: dict):
37
+ pass
38
+
39
+
40
+ class Storage:
41
+ def __init__(self, parent):
42
+ self.base_url = parent.base_url
43
+ self.headers = parent.headers
44
+ self.api_key = parent.api_key
45
+
46
+ def upload(self, connection_id: str, file_path: str, prefix: str = None):
47
+ url = f"{self.base_url}connections/storage?connection_id={connection_id}"
48
+ if prefix:
49
+ url += f"&prefix={prefix}"
50
+
51
+ files=[
52
+ ('file',(os.path.basename(file_path),open(file_path,'rb'),'application/octet-stream'))
53
+ ]
54
+ headers = {
55
+ 'Authorization': f'Bearer {self.api_key}'
56
+ }
57
+
58
+ response = requests.request("POST", url, headers=headers, files=files)
59
+
60
+ return response.json()
61
+
62
+
63
+ # mixpeek.connections.storage.delete(connection_id="123", file_name="example.txt")
64
+ def delete(self, connection_id: str, file_name: str):
65
+ url = f"{self.base_url}storage/{connection_id}/delete/{file_name}"
66
+ response = requests.delete(url, headers=self.headers)
67
+ return response.json()
68
+
69
+
70
+
71
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mixpeek
3
- Version: 0.6.27
3
+ Version: 0.6.29
4
4
  Summary: Mixpeek Python SDK
5
5
  Home-page: https://github.com/mixpeek/mixpeek-python
6
6
  Author: Ethan Steininger
@@ -101,6 +101,15 @@ mixpeek.connections.data.delete(
101
101
  )
102
102
  ```
103
103
 
104
+ Upload file
105
+
106
+ ```python
107
+ mixpeek.connections.storage.upload(
108
+ connection_id="conn_321",
109
+ file_path="/my/local/file.mp4"
110
+ )
111
+ ```
112
+
104
113
  ### Tools
105
114
 
106
115
  ```python
@@ -6,7 +6,7 @@ with open('requirements.txt') as f:
6
6
 
7
7
  setup(
8
8
  name='mixpeek',
9
- version='0.6.27',
9
+ version='0.6.29',
10
10
  author='Ethan Steininger',
11
11
  author_email='ethan@mixpeek.com',
12
12
  description='Mixpeek Python SDK',
@@ -1,36 +0,0 @@
1
- import requests
2
-
3
- class Connections:
4
- def __init__(self, base_url, headers):
5
- self.base_url = base_url
6
- self.headers = headers
7
- self.data = self.Data(self)
8
-
9
- def create(self, alias: str, engine: str, details: dict):
10
- url = f"{self.base_url}connections/"
11
- data = {
12
- "alias": alias,
13
- "engine": engine,
14
- "details": details
15
- }
16
- response = requests.post(url, json=data, headers=self.headers)
17
- return response.json()
18
-
19
- class Data:
20
- def __init__(self, parent):
21
- self.base_url = parent.base_url
22
- self.headers = parent.headers
23
-
24
- # mixpeek.connections.data.insert(connection_id="123", payload={"key": "value"})
25
- def insert(self, connection_id: str, payload: list):
26
- pass
27
-
28
- # mixpeek.connections.data.delete(connection_id="123", filters={"key": "value"})
29
- def delete(self, connection_id: str, filters: dict):
30
- pass
31
-
32
- # mixpeek.connections.data.upsert(connection_id="123", payload={"key": "value"}, filters={"key": "value"})
33
- def upsert(self, connection_id: str, payload: dict, filters: dict):
34
- pass
35
-
36
-
File without changes
File without changes
File without changes
File without changes
File without changes