polyanalyst6api 0.35.1__tar.gz → 0.35.3__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: polyanalyst6api
3
- Version: 0.35.1
3
+ Version: 0.35.3
4
4
  Summary: polyanalyst6api is a PolyAnalyst API client for Python.
5
5
  Home-page: https://github.com/Megaputer/polyanalyst6api-py
6
6
  License: MIT
@@ -16,10 +16,11 @@ Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
19
20
  Classifier: Topic :: Internet
20
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
22
  Requires-Dist: pytus (>=0.2.1,<0.3.0)
22
- Requires-Dist: requests (>=2.28,<3.0)
23
+ Requires-Dist: requests (>=2.31,<3.0)
23
24
  Requires-Dist: urllib3 (==1.26.18) ; python_version == "3.7"
24
25
  Requires-Dist: urllib3 ; python_version >= "3.8"
25
26
  Project-URL: Changelog, https://github.com/Megaputer/polyanalyst6api-py/blob/master/CHANGELOG.md
@@ -33,78 +34,59 @@ Description-Content-Type: text/markdown
33
34
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/polyanalyst6api)](https://pypi.org/project/polyanalyst6api/)
34
35
  [![MIT License](https://img.shields.io/github/license/megaputer/polyanalyst6api-py)](https://github.com/Megaputer/polyanalyst6api-py/blob/master/LICENSE)
35
36
 
36
- **_polyanalyst6api_ is a simple and easy to use client library for the PolyAnalyst API.**
37
+ Welcome to the official Python client library for the PolyAnalyst REST API.
37
38
 
38
- This package provides wrappers for PolyAnalyst `Analytical Client`, `Scheduler` and `Drive`.
39
- Using it you can execute nodes, view datasets, run tasks, download/upload files and so on.
39
+ This package provides python wrappers for PolyAnalyst applications, such as *Analytical Client*, *Scheduler*, *Drive*.
40
+ Using `polyanalyst6api` you can access and edit projects, publications, files and more.
40
41
 
41
42
  ## Installation
42
43
 
43
- Python 3.7+ is required. Install and upgrade `polyanalyst6api` with these commands:
44
-
45
44
  ```shell
46
- pip install polyanalyst6api
47
- pip install --upgrade polyanalyst6api
45
+ pip install -u polyanalyst6api
48
46
  ```
47
+ > Python 3.7 or later is required.
49
48
 
50
49
  ## Documentation
51
50
 
52
51
  See [API Reference](https://polyanalyst6api-py.rtfd.io) for the client library methods.
53
52
 
54
- Refer to **PolyAnalyst User Manual** at **Application Programming Interfaces** > **Version 01** for REST API specification.
53
+ Refer to PolyAnalyst's **User Manual** at **Application Programming Interfaces** > **Version 1** for REST API specification.
55
54
 
56
55
  ## Usage
57
56
 
58
- Import an api client and log in to PolyAnalyst server
59
-
57
+ Import and initialize a client:
60
58
  ```python
61
59
  from polyanalyst6api import API
62
60
 
63
- with API(POLYANALIST_URL, USERNAME, PASSWORD) as api:
64
- # making a request to PolyAnalyst endpoint that require authorization
65
- print(api.get_server_info())
66
- ```
61
+ # using an api token
62
+ client = API(<POLYANALIST_URL>, token=<API_TOKEN>)
67
63
 
68
- ### Working with project
69
-
70
- Instantiate project wrapper by calling with existing project ID:
71
- ```python
72
- prj = api.project(PROJECT_UUID)
73
- ```
74
-
75
- Set `Python` node code using parent `Parameters` node.
76
- ```python
77
- prj.parameters('Parameters (1)').set(
78
- 'Dataset/Python',
79
- {'Script': 'result = pandas.DataFrame([{"val": 42}])'}
80
- )
81
- ```
82
-
83
- Execute `Python` node and wait to complete execution
84
- ```python
85
- prj.execute('Python', wait=True)
86
- ```
87
-
88
- Check node results:
89
- ```python
90
- ds = prj.dataset('Python').preview()
91
- assert ds[0]['val'] == 42
92
- ```
93
-
94
- Save project:
95
- ```python
96
- prj.save()
64
+ # or using PolyAnalyst user credentials. Note that in this case you need to call .login()
65
+ client = API(<POLYANALIST_URL>, <USERNAME>, <PASSWORD>)
66
+ client.login()
97
67
  ```
98
68
 
99
- ### Downloading file from user home folder using PA Drive API
69
+ Request data using client methods:
100
70
 
101
71
  ```python
102
- content = api.drive.download_file('README.txt')
103
- with open(r'C:\README.txt', mode='wb+') as local_file:
104
- local_file.write(content)
72
+ >>> prj = client.project(<prjUUID>)
73
+ >>> prj.status()
74
+ {'status': 'Loaded'}
75
+
76
+ >>> prj.get_node_list()
77
+ [{'id': 11,
78
+ 'name': 'Internet Source',
79
+ 'status': 'synchronized',
80
+ 'subtype': 'INET',
81
+ 'type': 'DataSource'},
82
+ {'id': 12,
83
+ 'name': 'Python',
84
+ 'status': 'synchronized',
85
+ 'subtype': 'Python',
86
+ 'type': 'Dataset'}]
105
87
  ```
106
88
 
107
- See [polyanalyst6api-python/examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) for more complex examples.
89
+ View the [examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) directory for more code snippets.
108
90
 
109
91
  ## License
110
92
 
@@ -0,0 +1,63 @@
1
+ [![Telegram Group](https://img.shields.io/badge/support-join-blue?logo=telegram)](https://t.me/+_AdHkBRnul4xZTg6)
2
+ [![PyPI package](https://img.shields.io/pypi/v/polyanalyst6api)](https://pypi.org/project/polyanalyst6api)
3
+ [![Downloads](https://static.pepy.tech/badge/polyanalyst6api/month)](https://pepy.tech/project/polyanalyst6api)
4
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/polyanalyst6api)](https://pypi.org/project/polyanalyst6api/)
5
+ [![MIT License](https://img.shields.io/github/license/megaputer/polyanalyst6api-py)](https://github.com/Megaputer/polyanalyst6api-py/blob/master/LICENSE)
6
+
7
+ Welcome to the official Python client library for the PolyAnalyst REST API.
8
+
9
+ This package provides python wrappers for PolyAnalyst applications, such as *Analytical Client*, *Scheduler*, *Drive*.
10
+ Using `polyanalyst6api` you can access and edit projects, publications, files and more.
11
+
12
+ ## Installation
13
+
14
+ ```shell
15
+ pip install -u polyanalyst6api
16
+ ```
17
+ > Python 3.7 or later is required.
18
+
19
+ ## Documentation
20
+
21
+ See [API Reference](https://polyanalyst6api-py.rtfd.io) for the client library methods.
22
+
23
+ Refer to PolyAnalyst's **User Manual** at **Application Programming Interfaces** > **Version 1** for REST API specification.
24
+
25
+ ## Usage
26
+
27
+ Import and initialize a client:
28
+ ```python
29
+ from polyanalyst6api import API
30
+
31
+ # using an api token
32
+ client = API(<POLYANALIST_URL>, token=<API_TOKEN>)
33
+
34
+ # or using PolyAnalyst user credentials. Note that in this case you need to call .login()
35
+ client = API(<POLYANALIST_URL>, <USERNAME>, <PASSWORD>)
36
+ client.login()
37
+ ```
38
+
39
+ Request data using client methods:
40
+
41
+ ```python
42
+ >>> prj = client.project(<prjUUID>)
43
+ >>> prj.status()
44
+ {'status': 'Loaded'}
45
+
46
+ >>> prj.get_node_list()
47
+ [{'id': 11,
48
+ 'name': 'Internet Source',
49
+ 'status': 'synchronized',
50
+ 'subtype': 'INET',
51
+ 'type': 'DataSource'},
52
+ {'id': 12,
53
+ 'name': 'Python',
54
+ 'status': 'synchronized',
55
+ 'subtype': 'Python',
56
+ 'type': 'Dataset'}]
57
+ ```
58
+
59
+ View the [examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) directory for more code snippets.
60
+
61
+ ## License
62
+
63
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/Megaputer/polyanalyst6api-py/tree/master/LICENSE) file for details
@@ -1,4 +1,4 @@
1
- __version__ = '0.35.1'
1
+ __version__ = '0.35.2'
2
2
 
3
3
  from .api import *
4
4
  from .exceptions import *
@@ -116,6 +116,8 @@ class API:
116
116
  )
117
117
  self._s.mount('http://', adapter)
118
118
  self._s.mount('https://', adapter)
119
+ # do not retry SSLError. without this login takes ~30 seconds to throw an error
120
+ self._s.mount('https://', HTTPAdapter(max_retries=urllib3.util.Retry(0, status_forcelist=[495])))
119
121
  self._s.verify = kwargs.get('verify', True)
120
122
  self._s.headers.update({'User-Agent': self.user_agent})
121
123
 
@@ -256,7 +258,7 @@ class API:
256
258
  time.sleep(1)
257
259
  status = self.get_project_import_status(import_id)
258
260
  # status has only empty state key when the server rebooted during the project import: T32492#776729
259
- if status.get('state') in ('Error', 'Imported'):
261
+ if status.get('state') in ('Error', 'Imported', 'Cancelled'):
260
262
  return status
261
263
 
262
264
  def project(self, uuid: str) -> Project:
@@ -277,6 +277,14 @@ class Project:
277
277
  .. versionadded:: 0.31
278
278
  """
279
279
  return self.api.get('project/status', params={'prjUUID': self.uuid})
280
+
281
+ def info(self):
282
+ """This operation returns information about a project.
283
+
284
+ :return: project information
285
+ """
286
+ return self.api.get('project/info', params={'prjUUID': self.uuid})
287
+
280
288
 
281
289
  def unload(self, force_unload: bool = False) -> None:
282
290
  """
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "polyanalyst6api"
3
- version = "0.35.1"
3
+ version = "0.35.3"
4
4
  description = "polyanalyst6api is a PolyAnalyst API client for Python."
5
5
  authors = ["yatmanov <yatmanov@megaputer.ru>"]
6
6
  license = "MIT"
@@ -21,7 +21,7 @@ classifiers = [
21
21
 
22
22
  [tool.poetry.dependencies]
23
23
  python = "^3.7"
24
- requests = "^2.28"
24
+ requests = "^2.31"
25
25
  pytus = "^0.2.1"
26
26
  urllib3 = [
27
27
  {version = "1.26.18", python = "3.7"},
@@ -33,12 +33,4 @@ pytest = "^7.4.0"
33
33
 
34
34
  [tool.poetry.group.docs.dependencies]
35
35
  sphinx = {version = "^7.0.1", python = "3.11"}
36
- towncrier = "^23.6.0"
37
36
  sphinx-autodoc-typehints = {version = "^1.23.3", python = "3.11"}
38
-
39
- [tool.towncrier]
40
- package = "polyanalyst6api"
41
- package_dir = "polyanalyst6api"
42
- filename = "CHANGELOG.md"
43
- directory = ".changes"
44
- title_format = "{version} ({project_date})"
@@ -1,82 +0,0 @@
1
- [![Telegram Group](https://img.shields.io/badge/support-join-blue?logo=telegram)](https://t.me/+_AdHkBRnul4xZTg6)
2
- [![PyPI package](https://img.shields.io/pypi/v/polyanalyst6api)](https://pypi.org/project/polyanalyst6api)
3
- [![Downloads](https://static.pepy.tech/badge/polyanalyst6api/month)](https://pepy.tech/project/polyanalyst6api)
4
- [![Supported Python versions](https://img.shields.io/pypi/pyversions/polyanalyst6api)](https://pypi.org/project/polyanalyst6api/)
5
- [![MIT License](https://img.shields.io/github/license/megaputer/polyanalyst6api-py)](https://github.com/Megaputer/polyanalyst6api-py/blob/master/LICENSE)
6
-
7
- **_polyanalyst6api_ is a simple and easy to use client library for the PolyAnalyst API.**
8
-
9
- This package provides wrappers for PolyAnalyst `Analytical Client`, `Scheduler` and `Drive`.
10
- Using it you can execute nodes, view datasets, run tasks, download/upload files and so on.
11
-
12
- ## Installation
13
-
14
- Python 3.7+ is required. Install and upgrade `polyanalyst6api` with these commands:
15
-
16
- ```shell
17
- pip install polyanalyst6api
18
- pip install --upgrade polyanalyst6api
19
- ```
20
-
21
- ## Documentation
22
-
23
- See [API Reference](https://polyanalyst6api-py.rtfd.io) for the client library methods.
24
-
25
- Refer to **PolyAnalyst User Manual** at **Application Programming Interfaces** > **Version 01** for REST API specification.
26
-
27
- ## Usage
28
-
29
- Import an api client and log in to PolyAnalyst server
30
-
31
- ```python
32
- from polyanalyst6api import API
33
-
34
- with API(POLYANALIST_URL, USERNAME, PASSWORD) as api:
35
- # making a request to PolyAnalyst endpoint that require authorization
36
- print(api.get_server_info())
37
- ```
38
-
39
- ### Working with project
40
-
41
- Instantiate project wrapper by calling with existing project ID:
42
- ```python
43
- prj = api.project(PROJECT_UUID)
44
- ```
45
-
46
- Set `Python` node code using parent `Parameters` node.
47
- ```python
48
- prj.parameters('Parameters (1)').set(
49
- 'Dataset/Python',
50
- {'Script': 'result = pandas.DataFrame([{"val": 42}])'}
51
- )
52
- ```
53
-
54
- Execute `Python` node and wait to complete execution
55
- ```python
56
- prj.execute('Python', wait=True)
57
- ```
58
-
59
- Check node results:
60
- ```python
61
- ds = prj.dataset('Python').preview()
62
- assert ds[0]['val'] == 42
63
- ```
64
-
65
- Save project:
66
- ```python
67
- prj.save()
68
- ```
69
-
70
- ### Downloading file from user home folder using PA Drive API
71
-
72
- ```python
73
- content = api.drive.download_file('README.txt')
74
- with open(r'C:\README.txt', mode='wb+') as local_file:
75
- local_file.write(content)
76
- ```
77
-
78
- See [polyanalyst6api-python/examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) for more complex examples.
79
-
80
- ## License
81
-
82
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/Megaputer/polyanalyst6api-py/tree/master/LICENSE) file for details