neurograph-core 1.202508112256__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.
- neurograph/__init__.py +0 -0
- neurograph/v1/__init__.py +227 -0
- neurograph/v1/api/__init__.py +15 -0
- neurograph/v1/api/atlas_api.py +588 -0
- neurograph/v1/api/authentication_api.py +830 -0
- neurograph/v1/api/client_api.py +1684 -0
- neurograph/v1/api/client_metadata_api.py +871 -0
- neurograph/v1/api/lookup_api.py +1049 -0
- neurograph/v1/api/organization_api.py +1975 -0
- neurograph/v1/api/organization_metadata_api.py +872 -0
- neurograph/v1/api/persona_api.py +1920 -0
- neurograph/v1/api/system_api.py +293 -0
- neurograph/v1/api/tasks_api.py +285 -0
- neurograph/v1/api/workbench_api.py +857 -0
- neurograph/v1/api_client.py +801 -0
- neurograph/v1/api_response.py +21 -0
- neurograph/v1/configuration.py +612 -0
- neurograph/v1/exceptions.py +216 -0
- neurograph/v1/models/__init__.py +96 -0
- neurograph/v1/models/atlas_atlas_version.py +99 -0
- neurograph/v1/models/atlas_atlas_version_many_response.py +97 -0
- neurograph/v1/models/atlas_atlas_version_response.py +101 -0
- neurograph/v1/models/atlas_atlas_version_upsert_request.py +95 -0
- neurograph/v1/models/auth_service_token_request.py +87 -0
- neurograph/v1/models/auth_test_service_token_response.py +89 -0
- neurograph/v1/models/auth_test_token_response.py +87 -0
- neurograph/v1/models/client_client.py +109 -0
- neurograph/v1/models/client_client_creat_response.py +111 -0
- neurograph/v1/models/client_client_create_request.py +95 -0
- neurograph/v1/models/client_client_get_detail_response.py +93 -0
- neurograph/v1/models/client_client_get_many_response.py +105 -0
- neurograph/v1/models/client_client_metadata_request.py +89 -0
- neurograph/v1/models/client_client_metadata_response.py +97 -0
- neurograph/v1/models/client_client_personas_response.py +99 -0
- neurograph/v1/models/client_client_url_upsert_request.py +99 -0
- neurograph/v1/models/client_client_url_upsert_response.py +101 -0
- neurograph/v1/models/client_client_urls_response.py +101 -0
- neurograph/v1/models/client_delete_metadata_request.py +87 -0
- neurograph/v1/models/client_kpi.py +93 -0
- neurograph/v1/models/client_metadata.py +93 -0
- neurograph/v1/models/client_persona.py +171 -0
- neurograph/v1/models/client_persona_factor.py +99 -0
- neurograph/v1/models/client_persona_insight.py +93 -0
- neurograph/v1/models/client_persona_personality_trait.py +93 -0
- neurograph/v1/models/client_query.py +93 -0
- neurograph/v1/models/db_client_url.py +99 -0
- neurograph/v1/models/db_persona_factor_create_params.py +97 -0
- neurograph/v1/models/lookup_language.py +97 -0
- neurograph/v1/models/lookup_lookup_language_response.py +97 -0
- neurograph/v1/models/lookup_lookup_state_response.py +97 -0
- neurograph/v1/models/lookup_state.py +91 -0
- neurograph/v1/models/lookup_state_response.py +93 -0
- neurograph/v1/models/organizations_atlas_config.py +97 -0
- neurograph/v1/models/organizations_brand_detail_response.py +109 -0
- neurograph/v1/models/organizations_brand_upsert_request.py +107 -0
- neurograph/v1/models/organizations_delete_metadata_request.py +87 -0
- neurograph/v1/models/organizations_delete_metadata_response.py +97 -0
- neurograph/v1/models/organizations_metadata.py +93 -0
- neurograph/v1/models/organizations_organization.py +103 -0
- neurograph/v1/models/organizations_organization_brand.py +107 -0
- neurograph/v1/models/organizations_organization_create_request.py +97 -0
- neurograph/v1/models/organizations_organization_detail_response.py +123 -0
- neurograph/v1/models/organizations_organization_get_many_response.py +103 -0
- neurograph/v1/models/organizations_organization_metadata_request.py +89 -0
- neurograph/v1/models/organizations_organization_metadata_response.py +97 -0
- neurograph/v1/models/organizations_organization_set_atlas_request.py +93 -0
- neurograph/v1/models/organizations_organization_set_atlas_response.py +99 -0
- neurograph/v1/models/organizations_organization_set_workbench_request.py +93 -0
- neurograph/v1/models/organizations_organization_set_workbench_response.py +99 -0
- neurograph/v1/models/organizations_organization_update_request.py +99 -0
- neurograph/v1/models/organizations_workbench_config.py +97 -0
- neurograph/v1/models/personas_match_criteria_row.py +97 -0
- neurograph/v1/models/personas_match_criteria_row_in.py +93 -0
- neurograph/v1/models/personas_persona_factor.py +101 -0
- neurograph/v1/models/personas_persona_factor_create_request.py +95 -0
- neurograph/v1/models/personas_persona_factor_create_response.py +97 -0
- neurograph/v1/models/personas_persona_insight_create_request.py +91 -0
- neurograph/v1/models/personas_persona_insight_create_response.py +95 -0
- neurograph/v1/models/personas_persona_instance_create_request.py +123 -0
- neurograph/v1/models/personas_persona_instance_create_response.py +127 -0
- neurograph/v1/models/personas_persona_kpi_create_request.py +95 -0
- neurograph/v1/models/personas_persona_kpi_create_response.py +97 -0
- neurograph/v1/models/personas_persona_kpi_req.py +91 -0
- neurograph/v1/models/personas_persona_kpi_resp.py +95 -0
- neurograph/v1/models/personas_persona_match_criteria_request.py +95 -0
- neurograph/v1/models/personas_persona_match_criteria_response.py +97 -0
- neurograph/v1/models/personas_persona_seed_create_request.py +89 -0
- neurograph/v1/models/personas_persona_seed_create_response.py +97 -0
- neurograph/v1/models/personas_persona_trait_create_request.py +95 -0
- neurograph/v1/models/personas_persona_trait_create_response.py +97 -0
- neurograph/v1/models/personas_personality_trait_in.py +91 -0
- neurograph/v1/models/personas_personality_trait_out.py +95 -0
- neurograph/v1/models/tasks_sync_from_firebase_result.py +87 -0
- neurograph/v1/models/workbench_workbench_url_check_request.py +87 -0
- neurograph/v1/models/workbench_workbench_url_check_response.py +111 -0
- neurograph/v1/models/workbench_workbench_version.py +99 -0
- neurograph/v1/models/workbench_workbench_version_many_response.py +97 -0
- neurograph/v1/models/workbench_workbench_version_response.py +101 -0
- neurograph/v1/models/workbench_workbench_version_upsert_request.py +95 -0
- neurograph/v1/py.typed +0 -0
- neurograph/v1/rest.py +258 -0
- neurograph_core-1.202508112256.dist-info/METADATA +62 -0
- neurograph_core-1.202508112256.dist-info/RECORD +105 -0
- neurograph_core-1.202508112256.dist-info/WHEEL +5 -0
- neurograph_core-1.202508112256.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Neurograph Core
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from neurograph.v1.models.workbench_workbench_version import WorkbenchWorkbenchVersion
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class WorkbenchWorkbenchVersionManyResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
WorkbenchWorkbenchVersionManyResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
data: Optional[List[WorkbenchWorkbenchVersion]] = None
|
|
31
|
+
error: Optional[StrictStr] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["data", "error"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of WorkbenchWorkbenchVersionManyResponse from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.data:
|
|
76
|
+
for _item_data in self.data:
|
|
77
|
+
if _item_data:
|
|
78
|
+
_items.append(_item_data.to_dict())
|
|
79
|
+
_dict['data'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of WorkbenchWorkbenchVersionManyResponse from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"data": [WorkbenchWorkbenchVersion.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
|
|
93
|
+
"error": obj.get("error")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Neurograph Core
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class WorkbenchWorkbenchVersionResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
WorkbenchWorkbenchVersionResponse
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
description: Optional[StrictStr] = None
|
|
30
|
+
error: Optional[StrictStr] = None
|
|
31
|
+
id: Optional[StrictInt] = None
|
|
32
|
+
is_active: Optional[StrictBool] = None
|
|
33
|
+
name: Optional[StrictStr] = None
|
|
34
|
+
ts_created: Optional[StrictInt] = Field(default=None, description="Config map[string]interface{} `json:\"config\"`")
|
|
35
|
+
ts_updated: Optional[StrictInt] = None
|
|
36
|
+
version: Optional[StrictStr] = None
|
|
37
|
+
__properties: ClassVar[List[str]] = ["description", "error", "id", "is_active", "name", "ts_created", "ts_updated", "version"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of WorkbenchWorkbenchVersionResponse from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of WorkbenchWorkbenchVersionResponse from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"description": obj.get("description"),
|
|
91
|
+
"error": obj.get("error"),
|
|
92
|
+
"id": obj.get("id"),
|
|
93
|
+
"is_active": obj.get("is_active"),
|
|
94
|
+
"name": obj.get("name"),
|
|
95
|
+
"ts_created": obj.get("ts_created"),
|
|
96
|
+
"ts_updated": obj.get("ts_updated"),
|
|
97
|
+
"version": obj.get("version")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Neurograph Core
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class WorkbenchWorkbenchVersionUpsertRequest(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
WorkbenchWorkbenchVersionUpsertRequest
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
description: Optional[StrictStr] = None
|
|
30
|
+
id: Optional[StrictInt] = None
|
|
31
|
+
is_active: Optional[StrictBool] = None
|
|
32
|
+
name: Optional[StrictStr] = None
|
|
33
|
+
version: Optional[StrictStr] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["description", "id", "is_active", "name", "version"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of WorkbenchWorkbenchVersionUpsertRequest from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of WorkbenchWorkbenchVersionUpsertRequest from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"description": obj.get("description"),
|
|
88
|
+
"id": obj.get("id"),
|
|
89
|
+
"is_active": obj.get("is_active"),
|
|
90
|
+
"name": obj.get("name"),
|
|
91
|
+
"version": obj.get("version")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
neurograph/v1/py.typed
ADDED
|
File without changes
|
neurograph/v1/rest.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Neurograph Core
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
import ssl
|
|
19
|
+
|
|
20
|
+
import urllib3
|
|
21
|
+
|
|
22
|
+
from neurograph.v1.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
|
25
|
+
RESTResponseType = urllib3.HTTPResponse
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_socks_proxy_url(url):
|
|
29
|
+
if url is None:
|
|
30
|
+
return False
|
|
31
|
+
split_section = url.split("://")
|
|
32
|
+
if len(split_section) < 2:
|
|
33
|
+
return False
|
|
34
|
+
else:
|
|
35
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class RESTResponse(io.IOBase):
|
|
39
|
+
|
|
40
|
+
def __init__(self, resp) -> None:
|
|
41
|
+
self.response = resp
|
|
42
|
+
self.status = resp.status
|
|
43
|
+
self.reason = resp.reason
|
|
44
|
+
self.data = None
|
|
45
|
+
|
|
46
|
+
def read(self):
|
|
47
|
+
if self.data is None:
|
|
48
|
+
self.data = self.response.data
|
|
49
|
+
return self.data
|
|
50
|
+
|
|
51
|
+
def getheaders(self):
|
|
52
|
+
"""Returns a dictionary of the response headers."""
|
|
53
|
+
return self.response.headers
|
|
54
|
+
|
|
55
|
+
def getheader(self, name, default=None):
|
|
56
|
+
"""Returns a given response header."""
|
|
57
|
+
return self.response.headers.get(name, default)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RESTClientObject:
|
|
61
|
+
|
|
62
|
+
def __init__(self, configuration) -> None:
|
|
63
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
65
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
66
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
67
|
+
|
|
68
|
+
# cert_reqs
|
|
69
|
+
if configuration.verify_ssl:
|
|
70
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
71
|
+
else:
|
|
72
|
+
cert_reqs = ssl.CERT_NONE
|
|
73
|
+
|
|
74
|
+
pool_args = {
|
|
75
|
+
"cert_reqs": cert_reqs,
|
|
76
|
+
"ca_certs": configuration.ssl_ca_cert,
|
|
77
|
+
"cert_file": configuration.cert_file,
|
|
78
|
+
"key_file": configuration.key_file,
|
|
79
|
+
"ca_cert_data": configuration.ca_cert_data,
|
|
80
|
+
}
|
|
81
|
+
if configuration.assert_hostname is not None:
|
|
82
|
+
pool_args['assert_hostname'] = (
|
|
83
|
+
configuration.assert_hostname
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
if configuration.retries is not None:
|
|
87
|
+
pool_args['retries'] = configuration.retries
|
|
88
|
+
|
|
89
|
+
if configuration.tls_server_name:
|
|
90
|
+
pool_args['server_hostname'] = configuration.tls_server_name
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if configuration.socket_options is not None:
|
|
94
|
+
pool_args['socket_options'] = configuration.socket_options
|
|
95
|
+
|
|
96
|
+
if configuration.connection_pool_maxsize is not None:
|
|
97
|
+
pool_args['maxsize'] = configuration.connection_pool_maxsize
|
|
98
|
+
|
|
99
|
+
# https pool manager
|
|
100
|
+
self.pool_manager: urllib3.PoolManager
|
|
101
|
+
|
|
102
|
+
if configuration.proxy:
|
|
103
|
+
if is_socks_proxy_url(configuration.proxy):
|
|
104
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
|
105
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
106
|
+
pool_args["headers"] = configuration.proxy_headers
|
|
107
|
+
self.pool_manager = SOCKSProxyManager(**pool_args)
|
|
108
|
+
else:
|
|
109
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
110
|
+
pool_args["proxy_headers"] = configuration.proxy_headers
|
|
111
|
+
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
|
112
|
+
else:
|
|
113
|
+
self.pool_manager = urllib3.PoolManager(**pool_args)
|
|
114
|
+
|
|
115
|
+
def request(
|
|
116
|
+
self,
|
|
117
|
+
method,
|
|
118
|
+
url,
|
|
119
|
+
headers=None,
|
|
120
|
+
body=None,
|
|
121
|
+
post_params=None,
|
|
122
|
+
_request_timeout=None
|
|
123
|
+
):
|
|
124
|
+
"""Perform requests.
|
|
125
|
+
|
|
126
|
+
:param method: http request method
|
|
127
|
+
:param url: http request url
|
|
128
|
+
:param headers: http request headers
|
|
129
|
+
:param body: request json body, for `application/json`
|
|
130
|
+
:param post_params: request post parameters,
|
|
131
|
+
`application/x-www-form-urlencoded`
|
|
132
|
+
and `multipart/form-data`
|
|
133
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
134
|
+
number provided, it will be total request
|
|
135
|
+
timeout. It can also be a pair (tuple) of
|
|
136
|
+
(connection, read) timeouts.
|
|
137
|
+
"""
|
|
138
|
+
method = method.upper()
|
|
139
|
+
assert method in [
|
|
140
|
+
'GET',
|
|
141
|
+
'HEAD',
|
|
142
|
+
'DELETE',
|
|
143
|
+
'POST',
|
|
144
|
+
'PUT',
|
|
145
|
+
'PATCH',
|
|
146
|
+
'OPTIONS'
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
if post_params and body:
|
|
150
|
+
raise ApiValueError(
|
|
151
|
+
"body parameter cannot be used with post_params parameter."
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
post_params = post_params or {}
|
|
155
|
+
headers = headers or {}
|
|
156
|
+
|
|
157
|
+
timeout = None
|
|
158
|
+
if _request_timeout:
|
|
159
|
+
if isinstance(_request_timeout, (int, float)):
|
|
160
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
161
|
+
elif (
|
|
162
|
+
isinstance(_request_timeout, tuple)
|
|
163
|
+
and len(_request_timeout) == 2
|
|
164
|
+
):
|
|
165
|
+
timeout = urllib3.Timeout(
|
|
166
|
+
connect=_request_timeout[0],
|
|
167
|
+
read=_request_timeout[1]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
try:
|
|
171
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
172
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
173
|
+
|
|
174
|
+
# no content type provided or payload is json
|
|
175
|
+
content_type = headers.get('Content-Type')
|
|
176
|
+
if (
|
|
177
|
+
not content_type
|
|
178
|
+
or re.search('json', content_type, re.IGNORECASE)
|
|
179
|
+
):
|
|
180
|
+
request_body = None
|
|
181
|
+
if body is not None:
|
|
182
|
+
request_body = json.dumps(body)
|
|
183
|
+
r = self.pool_manager.request(
|
|
184
|
+
method,
|
|
185
|
+
url,
|
|
186
|
+
body=request_body,
|
|
187
|
+
timeout=timeout,
|
|
188
|
+
headers=headers,
|
|
189
|
+
preload_content=False
|
|
190
|
+
)
|
|
191
|
+
elif content_type == 'application/x-www-form-urlencoded':
|
|
192
|
+
r = self.pool_manager.request(
|
|
193
|
+
method,
|
|
194
|
+
url,
|
|
195
|
+
fields=post_params,
|
|
196
|
+
encode_multipart=False,
|
|
197
|
+
timeout=timeout,
|
|
198
|
+
headers=headers,
|
|
199
|
+
preload_content=False
|
|
200
|
+
)
|
|
201
|
+
elif content_type == 'multipart/form-data':
|
|
202
|
+
# must del headers['Content-Type'], or the correct
|
|
203
|
+
# Content-Type which generated by urllib3 will be
|
|
204
|
+
# overwritten.
|
|
205
|
+
del headers['Content-Type']
|
|
206
|
+
# Ensures that dict objects are serialized
|
|
207
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
|
208
|
+
r = self.pool_manager.request(
|
|
209
|
+
method,
|
|
210
|
+
url,
|
|
211
|
+
fields=post_params,
|
|
212
|
+
encode_multipart=True,
|
|
213
|
+
timeout=timeout,
|
|
214
|
+
headers=headers,
|
|
215
|
+
preload_content=False
|
|
216
|
+
)
|
|
217
|
+
# Pass a `string` parameter directly in the body to support
|
|
218
|
+
# other content types than JSON when `body` argument is
|
|
219
|
+
# provided in serialized form.
|
|
220
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
221
|
+
r = self.pool_manager.request(
|
|
222
|
+
method,
|
|
223
|
+
url,
|
|
224
|
+
body=body,
|
|
225
|
+
timeout=timeout,
|
|
226
|
+
headers=headers,
|
|
227
|
+
preload_content=False
|
|
228
|
+
)
|
|
229
|
+
elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
|
|
230
|
+
request_body = "true" if body else "false"
|
|
231
|
+
r = self.pool_manager.request(
|
|
232
|
+
method,
|
|
233
|
+
url,
|
|
234
|
+
body=request_body,
|
|
235
|
+
preload_content=False,
|
|
236
|
+
timeout=timeout,
|
|
237
|
+
headers=headers)
|
|
238
|
+
else:
|
|
239
|
+
# Cannot generate the request from given parameters
|
|
240
|
+
msg = """Cannot prepare a request message for provided
|
|
241
|
+
arguments. Please check that your arguments match
|
|
242
|
+
declared content type."""
|
|
243
|
+
raise ApiException(status=0, reason=msg)
|
|
244
|
+
# For `GET`, `HEAD`
|
|
245
|
+
else:
|
|
246
|
+
r = self.pool_manager.request(
|
|
247
|
+
method,
|
|
248
|
+
url,
|
|
249
|
+
fields={},
|
|
250
|
+
timeout=timeout,
|
|
251
|
+
headers=headers,
|
|
252
|
+
preload_content=False
|
|
253
|
+
)
|
|
254
|
+
except urllib3.exceptions.SSLError as e:
|
|
255
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
256
|
+
raise ApiException(status=0, reason=msg)
|
|
257
|
+
|
|
258
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neurograph-core
|
|
3
|
+
Version: 1.202508112256
|
|
4
|
+
Summary: Neurograph Core
|
|
5
|
+
Home-page:
|
|
6
|
+
Author: Neurograph Development Team
|
|
7
|
+
Author-email: team@openapitools.org
|
|
8
|
+
License: (c) 2025 Neurograph. All rights reserved.
|
|
9
|
+
Project-URL: Repository, https://github.com/NeuroGraph-AI/core/
|
|
10
|
+
Keywords: OpenAPI,OpenAPI-Generator,Neurograph Core
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Classifier: License :: Other/Proprietary License
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
24
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
25
|
+
Requires-Dist: pydantic>=2
|
|
26
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
|
|
29
|
+
# Neurograph Core Python SDK
|
|
30
|
+
|
|
31
|
+
The Neurograph Core Python SDK provides convenient, type-safe access to the Neurograph Core API.
|
|
32
|
+
This guide covers local installation, authentication, and your first API call.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Quickstart
|
|
37
|
+
|
|
38
|
+
1. Activate your Python 3.12 virtual environment
|
|
39
|
+
|
|
40
|
+
2. Install the SDK in editable mode from your local repo
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install neurograph-core
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. Use your service token to make a call
|
|
47
|
+
```python
|
|
48
|
+
from neurograph.v1.configuration import Configuration
|
|
49
|
+
from neurograph.v1.api_client import ApiClient
|
|
50
|
+
from neurograph.v1.api import atlas_api
|
|
51
|
+
|
|
52
|
+
config = Configuration()
|
|
53
|
+
config.host = "https://core-staging.neurograph.io"
|
|
54
|
+
config.api_key['ApiKeyAuth'] = "<your service token>"
|
|
55
|
+
config.api_key_prefix['ApiKeyAuth'] = "Bearer"
|
|
56
|
+
|
|
57
|
+
with ApiClient(config) as client:
|
|
58
|
+
atlas = atlas_api.AtlasApi(client)
|
|
59
|
+
print(atlas.api_v1_atlas_versions_get())
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
---
|