api-to-dataframe 1.0.0__tar.gz → 1.0.2__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.
Files changed (18) hide show
  1. api_to_dataframe-1.0.0/README.md → api_to_dataframe-1.0.2/PKG-INFO +60 -1
  2. api_to_dataframe-1.0.0/PKG-INFO → api_to_dataframe-1.0.2/README.md +34 -22
  3. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/pyproject.toml +16 -8
  4. api_to_dataframe-1.0.2/src/api_to_dataframe/__init__.py +4 -0
  5. api_to_dataframe-1.0.2/src/api_to_dataframe/controller/client_builder.py +53 -0
  6. api_to_dataframe-1.0.0/src/api_to_dataframe/__init__.py +0 -2
  7. api_to_dataframe-1.0.0/src/api_to_dataframe/controller/client_builder.py +0 -20
  8. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/LICENSE +0 -0
  9. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/common/__init__.py +0 -0
  10. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/common/utils/__init__.py +0 -0
  11. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/common/utils/retry_strategies.py +0 -0
  12. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/config/config.py +0 -0
  13. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/controller/__init__.py +0 -0
  14. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/models/__init__.py +0 -0
  15. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/models/get_data.py +0 -0
  16. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/models/retainer.py +0 -0
  17. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/views/__init__.py +0 -0
  18. {api_to_dataframe-1.0.0 → api_to_dataframe-1.0.2}/src/api_to_dataframe/views/dataframe_metrics.py +0 -0
@@ -1,3 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: api-to-dataframe
3
+ Version: 1.0.2
4
+ Summary: A package to convert API responses to pandas dataframe
5
+ Home-page: https://github.com/IvanildoBarauna/api-to-dataframe
6
+ License: MIT
7
+ Author: IvanildoBarauna
8
+ Author-email: ivanildo.jnr@outlook.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Requires-Dist: pandas (>=2.2.2,<3.0.0)
20
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
21
+ Project-URL: Documentation, https://github.com/IvanildoBarauna/api-to-dataframe#readme
22
+ Project-URL: Issues, https://github.com/IvanildoBarauna/api-to-dataframe/issues
23
+ Project-URL: Repository, https://github.com/IvanildoBarauna/api-to-dataframe
24
+ Description-Content-Type: text/markdown
25
+
1
26
  # API to DataFrame
2
27
  Your solution to convert API responses to Pandas DataFrames with retry strategies and detailed reports.
3
28
 
@@ -12,7 +37,7 @@ Your solution to convert API responses to Pandas DataFrames with retry strategie
12
37
  [![CI](https://img.shields.io/github/actions/workflow/status/IvanildoBarauna/api-to-dataframe/CI.yaml?&style=for-the-badge&logo=githubactions&cacheSeconds=60&label=Tests+and+pre+build)](https://github.com/IvanildoBarauna/api-to-dataframe/actions/workflows/CI.yaml)
13
38
  [![CD](https://img.shields.io/github/actions/workflow/status/IvanildoBarauna/api-to-dataframe/CD.yaml?&style=for-the-badge&logo=githubactions&cacheSeconds=60&event=release&label=Package_publication)](https://github.com/IvanildoBarauna/api-to-dataframe/actions/workflows/CD.yaml)
14
39
 
15
- ![Codecov](https://img.shields.io/codecov/c/github/IvanildoBarauna/api-to-dataframe?style=for-the-badge&logo=codecov)
40
+ [![Codecov](https://img.shields.io/codecov/c/github/IvanildoBarauna/api-to-dataframe?style=for-the-badge&logo=codecov)](https://app.codecov.io/gh/IvanildoBarauna/api-to-dataframe)
16
41
 
17
42
  ## Project Stack
18
43
 
@@ -31,3 +56,37 @@ Your solution to convert API responses to Pandas DataFrames with retry strategie
31
56
 
32
57
  Python library that simplifies obtaining data from API endpoints by converting them directly into Pandas DataFrames. This library offers robust features, including retry strategies for failed requests and automatic generation of detailed reports on the received data.
33
58
 
59
+ ## Installation
60
+
61
+ To install the package using pip, use the following command:
62
+
63
+ ```sh
64
+ pip install api-to-dataframe
65
+ ```
66
+
67
+ To install the package using poetry, use the following command:
68
+
69
+ ```sh
70
+ poetry add api-to-dataframe
71
+ ```
72
+
73
+ ## How to use it
74
+
75
+ ``` python
76
+ ## Importing library
77
+ from api_to_dataframe import ClientBuilder, RetryStrategies
78
+
79
+ # Create a client for the API without retry strategy
80
+ client = ClientBuilder(endpoint="https://api.example.com", retry_strategy=RetryStrategies.NoRetryStrategy)
81
+ # or with LinearStrategy (In development, actually don't nothing)
82
+ client = ClientBuilder(endpoint="https://api.example.com", retry_strategy=RetryStrategies.LinearStrategy)
83
+
84
+ # Get data from the API
85
+ data = client.get_api_data()
86
+
87
+ # Convert the data to a DataFrame
88
+ df = client.api_to_dataframe(data)
89
+
90
+ # Display the DataFrame
91
+ print(df)
92
+ ```
@@ -1,24 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: api-to-dataframe
3
- Version: 1.0.0
4
- Summary: A package to convert API responses to pandas dataframe
5
- License: MIT
6
- Author: IvanildoBarauna
7
- Author-email: ivanildo.jnr@outlook.com
8
- Requires-Python: >=3.9,<4.0
9
- Classifier: Development Status :: 2 - Pre-Alpha
10
- Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.8
18
- Requires-Dist: pandas (==2.0.0)
19
- Requires-Dist: requests (==2.30.0)
20
- Description-Content-Type: text/markdown
21
-
22
1
  # API to DataFrame
23
2
  Your solution to convert API responses to Pandas DataFrames with retry strategies and detailed reports.
24
3
 
@@ -33,7 +12,7 @@ Your solution to convert API responses to Pandas DataFrames with retry strategie
33
12
  [![CI](https://img.shields.io/github/actions/workflow/status/IvanildoBarauna/api-to-dataframe/CI.yaml?&style=for-the-badge&logo=githubactions&cacheSeconds=60&label=Tests+and+pre+build)](https://github.com/IvanildoBarauna/api-to-dataframe/actions/workflows/CI.yaml)
34
13
  [![CD](https://img.shields.io/github/actions/workflow/status/IvanildoBarauna/api-to-dataframe/CD.yaml?&style=for-the-badge&logo=githubactions&cacheSeconds=60&event=release&label=Package_publication)](https://github.com/IvanildoBarauna/api-to-dataframe/actions/workflows/CD.yaml)
35
14
 
36
- ![Codecov](https://img.shields.io/codecov/c/github/IvanildoBarauna/api-to-dataframe?style=for-the-badge&logo=codecov)
15
+ [![Codecov](https://img.shields.io/codecov/c/github/IvanildoBarauna/api-to-dataframe?style=for-the-badge&logo=codecov)](https://app.codecov.io/gh/IvanildoBarauna/api-to-dataframe)
37
16
 
38
17
  ## Project Stack
39
18
 
@@ -52,4 +31,37 @@ Your solution to convert API responses to Pandas DataFrames with retry strategie
52
31
 
53
32
  Python library that simplifies obtaining data from API endpoints by converting them directly into Pandas DataFrames. This library offers robust features, including retry strategies for failed requests and automatic generation of detailed reports on the received data.
54
33
 
34
+ ## Installation
35
+
36
+ To install the package using pip, use the following command:
37
+
38
+ ```sh
39
+ pip install api-to-dataframe
40
+ ```
41
+
42
+ To install the package using poetry, use the following command:
43
+
44
+ ```sh
45
+ poetry add api-to-dataframe
46
+ ```
47
+
48
+ ## How to use it
49
+
50
+ ``` python
51
+ ## Importing library
52
+ from api_to_dataframe import ClientBuilder, RetryStrategies
53
+
54
+ # Create a client for the API without retry strategy
55
+ client = ClientBuilder(endpoint="https://api.example.com", retry_strategy=RetryStrategies.NoRetryStrategy)
56
+ # or with LinearStrategy (In development, actually don't nothing)
57
+ client = ClientBuilder(endpoint="https://api.example.com", retry_strategy=RetryStrategies.LinearStrategy)
58
+
59
+ # Get data from the API
60
+ data = client.get_api_data()
61
+
62
+ # Convert the data to a DataFrame
63
+ df = client.api_to_dataframe(data)
55
64
 
65
+ # Display the DataFrame
66
+ print(df)
67
+ ```
@@ -1,11 +1,10 @@
1
1
  [tool.poetry]
2
2
  name = "api-to-dataframe"
3
- version = "1.0.0"
3
+ version = "1.0.2"
4
4
  description = "A package to convert API responses to pandas dataframe"
5
5
  authors = ["IvanildoBarauna <ivanildo.jnr@outlook.com>"]
6
6
  readme = "README.md"
7
7
  license = "MIT"
8
- packages = [{ include = "api_to_dataframe", from = "src" }]
9
8
  classifiers=[
10
9
  "Development Status :: 2 - Pre-Alpha",
11
10
  "Intended Audience :: Developers",
@@ -14,19 +13,28 @@ classifiers=[
14
13
  "Programming Language :: Python :: 3.8",
15
14
  ]
16
15
 
16
+ homepage = "https://github.com/IvanildoBarauna/api-to-dataframe"
17
+ repository = "https://github.com/IvanildoBarauna/api-to-dataframe"
18
+ documentation = "https://github.com/IvanildoBarauna/api-to-dataframe#readme"
19
+
20
+ [tool.poetry.urls]
21
+ Homepage = "https://github.com/IvanildoBarauna/api-to-dataframe"
22
+ Documentation = "https://github.com/IvanildoBarauna/api-to-dataframe#readme"
23
+ Issues = "https://github.com/IvanildoBarauna/api-to-dataframe/issues"
24
+
25
+ [tool.setuptools.packages.find]
26
+ where = ["src"]
27
+ include = ["api_to_dataframe*"]
28
+
17
29
  [tool.poetry.group.dev.dependencies]
18
30
  poetry-dynamic-versioning = "^1.3.0"
19
31
  pytest = "^8.2.2"
20
32
  coverage = "^7.5.3"
21
33
 
22
- [tool.project.urls]
23
- url="https://github.com/IvanidoBarauna/api-to-dataframe"
24
- license="MIT"
25
-
26
34
  [tool.poetry.dependencies]
27
35
  python = "^3.9"
28
- pandas = "2.0.0"
29
- requests = "2.30.0"
36
+ pandas = "^2.2.2"
37
+ requests = "^2.32.3"
30
38
 
31
39
  [build-system]
32
40
  requires = ["poetry-core"]
@@ -0,0 +1,4 @@
1
+ from .controller.client_builder import ClientBuilder
2
+ from .common.utils.retry_strategies import RetryStrategies
3
+
4
+ __all__ = ['ClientBuilder', 'RetryStrategies']
@@ -0,0 +1,53 @@
1
+ from api_to_dataframe.common.utils.retry_strategies import RetryStrategies
2
+ from api_to_dataframe.models.get_data import GetData
3
+
4
+
5
+ class ClientBuilder:
6
+ """
7
+ Builder for creating clients that interact with an API endpoint and return data.
8
+
9
+ Attributes:
10
+ endpoint (str): The API endpoint to be accessed.
11
+ retry_strategy (RetryStrategies): The retry strategy for the request. Default is NoRetryStrategy.
12
+ """
13
+
14
+ def __init__(self, endpoint: str, retry_strategy: RetryStrategies = RetryStrategies.NoRetryStrategy):
15
+ """
16
+ Initializes an instance of ClientBuilder.
17
+
18
+ Args:
19
+ endpoint (str): The API endpoint to be accessed.
20
+ retry_strategy (RetryStrategies, optional): The retry strategy for the request. Default is NoRetryStrategy.
21
+
22
+ Raises:
23
+ ValueError: If the endpoint is empty.
24
+ """
25
+ if endpoint == "":
26
+ raise ValueError("::: endpoint param is mandatory :::")
27
+ else:
28
+ self.endpoint = endpoint
29
+ self.retry_strategy = retry_strategy
30
+
31
+ def get_api_data(self):
32
+ """
33
+ Retrieves data from the API using the defined endpoint and retry strategy.
34
+
35
+ Returns:
36
+ dict: The response from the API.
37
+ """
38
+ response = GetData.get_response(self.endpoint, self.retry_strategy)
39
+ return response
40
+
41
+ @staticmethod
42
+ def api_to_dataframe(response: dict):
43
+ """
44
+ Converts the API response into a DataFrame.
45
+
46
+ Args:
47
+ response (dict): The response from the API.
48
+
49
+ Returns:
50
+ DataFrame: The data converted into a DataFrame.
51
+ """
52
+ df = GetData.to_dataframe(response)
53
+ return df
@@ -1,2 +0,0 @@
1
- from api_to_dataframe.controller.client_builder import ClientBuilder
2
- from api_to_dataframe.common.utils.retry_strategies import RetryStrategies
@@ -1,20 +0,0 @@
1
- from api_to_dataframe.common.utils.retry_strategies import RetryStrategies
2
- from api_to_dataframe.models.get_data import GetData
3
-
4
-
5
- class ClientBuilder:
6
- def __init__(self, endpoint: str, retry_strategy: RetryStrategies = RetryStrategies.NoRetryStrategy):
7
- if endpoint == "":
8
- raise ValueError("::: endpoint param is mandatory :::")
9
- else:
10
- self.endpoint = endpoint
11
- self.retry_strategy = retry_strategy
12
-
13
- def get_api_data(self):
14
- response = GetData.get_response(self.endpoint, self.retry_strategy)
15
- return response
16
-
17
- @staticmethod
18
- def api_to_dataframe(response: dict):
19
- df = GetData.to_dataframe(response)
20
- return df