apiverve-codedetector 1.1.14__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.
@@ -0,0 +1,3 @@
1
+ from .apiClient import CodedetectorAPIClient, CodedetectorAPIClientError
2
+
3
+ __all__ = ['CodedetectorAPIClient', 'CodedetectorAPIClientError']
@@ -0,0 +1,250 @@
1
+ import re
2
+ from typing import Dict, Optional, Any
3
+ from dataclasses import dataclass, List
4
+ import requests
5
+
6
+
7
+ class CodedetectorAPIClientError(Exception):
8
+ """Custom exception for API client errors"""
9
+ def __init__(self, message: str, status_code: Optional[int] = None, response: Optional[Dict] = None):
10
+ self.message = message
11
+ self.status_code = status_code
12
+ self.response = response
13
+ super().__init__(self.message)
14
+
15
+
16
+ class ValidationError(CodedetectorAPIClientError):
17
+ """Custom exception for parameter validation errors"""
18
+ def __init__(self, errors: List[str]):
19
+ self.errors = errors
20
+ message = f"Validation failed: {' '.join(errors)}"
21
+ super().__init__(message)
22
+
23
+
24
+ class CodedetectorAPIClient:
25
+ # Validation rules for parameters (generated from schema)
26
+ VALIDATION_RULES = {
27
+ "code": {"type": "string", "required": True}
28
+ }
29
+
30
+ # Format validation patterns
31
+ FORMAT_PATTERNS = {
32
+ 'email': r'^[^\s@]+@[^\s@]+\.[^\s@]+$',
33
+ 'url': r'^https?://.+',
34
+ 'ip': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$',
35
+ 'date': r'^\d{4}-\d{2}-\d{2}$',
36
+ 'hexColor': r'^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$'
37
+ }
38
+
39
+ def __init__(self, api_key: str, secure: bool = True, debug: bool = False):
40
+ """
41
+ Initialize the CodedetectorAPIClient with the API key and optional settings
42
+
43
+ :param api_key: Your APIVerve API key
44
+ :param secure: Deprecated. Always set to True
45
+ :param debug: Enable debug logging (default: False)
46
+ :raises CodedetectorAPIClientError: If API key is invalid
47
+ """
48
+
49
+ self._validate_api_key(api_key)
50
+
51
+ self.api_key = api_key
52
+ self.secure = secure
53
+ self.debug = debug
54
+ self.base_url = 'https://api.apiverve.com/v1/codedetector'
55
+ self.headers = {
56
+ 'x-api-key': self.api_key,
57
+ 'auth-mode': 'pypi-package'
58
+ }
59
+
60
+ # Create a session for connection pooling
61
+ self.session = requests.Session()
62
+ self.session.headers.update(self.headers)
63
+
64
+ def _validate_api_key(self, api_key: str) -> None:
65
+ """
66
+ Validate the API key format
67
+
68
+ :param api_key: API key to validate
69
+ :raises CodedetectorAPIClientError: If API key is invalid
70
+ """
71
+ if not api_key or not api_key.strip():
72
+ raise CodedetectorAPIClientError(
73
+ "API key is required. Get your API key at: https://apiverve.com"
74
+ )
75
+
76
+ # Check format (GUID, prefixed keys like apv_xxx, or alphanumeric)
77
+ if not re.match(r'^[a-zA-Z0-9_-]+$', api_key):
78
+ raise CodedetectorAPIClientError(
79
+ "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores. "
80
+ "Get your API key at: https://apiverve.com"
81
+ )
82
+
83
+ def _log(self, message: str) -> None:
84
+ """
85
+ Log a debug message if debug mode is enabled
86
+
87
+ :param message: Message to log
88
+ """
89
+ if self.debug:
90
+ print(f"[CodedetectorAPIClient DEBUG] {message}")
91
+
92
+ def _validate_params(self, params: Optional[Dict[str, Any]]) -> None:
93
+ """
94
+ Validate parameters against schema rules
95
+
96
+ :param params: Parameters to validate
97
+ :raises ValidationError: If validation fails
98
+ """
99
+ if not self.VALIDATION_RULES:
100
+ return
101
+
102
+ errors = []
103
+ params = params or {}
104
+
105
+ for param_name, rules in self.VALIDATION_RULES.items():
106
+ value = params.get(param_name)
107
+
108
+ # Check required
109
+ if rules.get('required') and (value is None or value == ''):
110
+ errors.append(f"Required parameter [{param_name}] is missing.")
111
+ continue
112
+
113
+ # Skip validation if value is not provided and not required
114
+ if value is None:
115
+ continue
116
+
117
+ param_type = rules.get('type', 'string')
118
+
119
+ # Type validation
120
+ if param_type in ('integer', 'number'):
121
+ try:
122
+ num_value = float(value) if param_type == 'number' else int(value)
123
+
124
+ # Min/max validation
125
+ if 'min' in rules and num_value < rules['min']:
126
+ errors.append(f"Parameter [{param_name}] must be at least {rules['min']}.")
127
+ if 'max' in rules and num_value > rules['max']:
128
+ errors.append(f"Parameter [{param_name}] must be at most {rules['max']}.")
129
+ except (ValueError, TypeError):
130
+ errors.append(f"Parameter [{param_name}] must be a valid {param_type}.")
131
+ continue
132
+
133
+ elif param_type == 'string':
134
+ if not isinstance(value, str):
135
+ errors.append(f"Parameter [{param_name}] must be a string.")
136
+ continue
137
+
138
+ # Length validation
139
+ if 'minLength' in rules and len(value) < rules['minLength']:
140
+ errors.append(f"Parameter [{param_name}] must be at least {rules['minLength']} characters.")
141
+ if 'maxLength' in rules and len(value) > rules['maxLength']:
142
+ errors.append(f"Parameter [{param_name}] must be at most {rules['maxLength']} characters.")
143
+
144
+ # Format validation
145
+ if 'format' in rules and rules['format'] in self.FORMAT_PATTERNS:
146
+ pattern = self.FORMAT_PATTERNS[rules['format']]
147
+ if not re.match(pattern, value, re.IGNORECASE):
148
+ errors.append(f"Parameter [{param_name}] must be a valid {rules['format']}.")
149
+
150
+ elif param_type == 'boolean':
151
+ if not isinstance(value, bool) and value not in ('true', 'false', True, False):
152
+ errors.append(f"Parameter [{param_name}] must be a boolean.")
153
+
154
+ elif param_type == 'array':
155
+ if not isinstance(value, list):
156
+ errors.append(f"Parameter [{param_name}] must be an array.")
157
+
158
+ # Enum validation
159
+ if 'enum' in rules and value not in rules['enum']:
160
+ errors.append(f"Parameter [{param_name}] must be one of: {', '.join(map(str, rules['enum']))}.")
161
+
162
+ if errors:
163
+ raise ValidationError(errors)
164
+
165
+ def execute(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: # Returns CodeDetectorData in 'data' field
166
+ """
167
+ Execute the API request
168
+
169
+ :param params: API parameters (optional)
170
+ :return: API response as a dictionary
171
+ :raises CodedetectorAPIClientError: If the request fails or returns an error
172
+ :raises ValidationError: If parameter validation fails
173
+ """
174
+
175
+ # Validate parameters against schema rules
176
+ self._validate_params(params)
177
+
178
+ method = "POST"
179
+
180
+ self._log(f"Making {method} request to {self.base_url}")
181
+ if params:
182
+ self._log(f"Parameters: {params}")
183
+
184
+ try:
185
+ if method.upper() == 'POST':
186
+ self._log("Sending POST request with JSON body")
187
+ response = self.session.post(self.base_url, json=params, timeout=30)
188
+ else:
189
+ self._log("Sending GET request with query parameters")
190
+ response = self.session.get(self.base_url, params=params, timeout=30)
191
+
192
+ self._log(f"Response status code: {response.status_code}")
193
+
194
+ # Try to parse JSON response
195
+ try:
196
+ response_data = response.json()
197
+ except ValueError as e:
198
+ raise CodedetectorAPIClientError(
199
+ f"Invalid JSON response from API: {str(e)}",
200
+ status_code=response.status_code
201
+ )
202
+
203
+ # Check for API-level errors in the response
204
+ if response_data.get('status') == 'error':
205
+ error_message = response_data.get('error', 'Unknown API error')
206
+ self._log(f"API returned error: {error_message}")
207
+ raise CodedetectorAPIClientError(
208
+ error_message,
209
+ status_code=response.status_code,
210
+ response=response_data
211
+ )
212
+
213
+ # Check HTTP status code
214
+ if not response.ok:
215
+ error_message = response_data.get('error', f"HTTP {response.status_code} error")
216
+ self._log(f"HTTP error: {error_message}")
217
+ raise CodedetectorAPIClientError(
218
+ error_message,
219
+ status_code=response.status_code,
220
+ response=response_data
221
+ )
222
+
223
+ self._log("Request successful")
224
+ return response_data
225
+
226
+ except requests.exceptions.Timeout as e:
227
+ self._log(f"Request timeout: {str(e)}")
228
+ raise CodedetectorAPIClientError(f"Request timeout: {str(e)}")
229
+ except requests.exceptions.ConnectionError as e:
230
+ self._log(f"Connection error: {str(e)}")
231
+ raise CodedetectorAPIClientError(f"Connection error: {str(e)}")
232
+ except requests.exceptions.RequestException as e:
233
+ self._log(f"Request exception: {str(e)}")
234
+ raise CodedetectorAPIClientError(f"Request failed: {str(e)}")
235
+
236
+
237
+ def close(self) -> None:
238
+ """
239
+ Close the session and release resources
240
+ """
241
+ self._log("Closing session")
242
+ self.session.close()
243
+
244
+ def __enter__(self):
245
+ """Context manager entry"""
246
+ return self
247
+
248
+ def __exit__(self, exc_type, exc_val, exc_tb):
249
+ """Context manager exit"""
250
+ self.close()
@@ -0,0 +1,3 @@
1
+ class CodedetectorCodeDetectorAPIError(Exception):
2
+ """A custom exception for API errors"""
3
+ pass
@@ -0,0 +1,26 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ import os
4
+ lib_folder = os.path.dirname(os.path.realpath(__file__))
5
+ requirements_file = os.path.join(lib_folder, 'requirements.txt')
6
+ install_requires = ["requests >= 2.25.1", "setuptools >= 56.0.0"]
7
+ if os.path.exists(requirements_file):
8
+ with open(requirements_file, 'r') as f:
9
+ install_requires = f.read().splitlines()
10
+
11
+ setup(
12
+ name='apiverve_codedetector',
13
+ version='1.1.14',
14
+ packages=find_packages(),
15
+ include_package_data=True,
16
+ install_requires=install_requires,
17
+ description='Code Detector is a simple tool for detecting the language of code in text. It returns details such as extension, language, family, and more.',
18
+ author='APIVerve',
19
+ author_email='hello@apiverve.com',
20
+ url='https://apiverve.com/marketplace/codedetector?utm_source=pypi&utm_medium=homepage',
21
+ classifiers=[
22
+ 'Programming Language :: Python :: 3',
23
+ 'Operating System :: OS Independent',
24
+ ],
25
+ python_requires='>=3.6',
26
+ )
@@ -0,0 +1,21 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='apiverve_codedetector',
5
+ version='1.1.14',
6
+ packages=find_packages(),
7
+ include_package_data=True,
8
+ install_requires=[
9
+ 'requests',
10
+ 'setuptools'
11
+ ],
12
+ description='Code Detector is a simple tool for detecting the language of code in text. It returns details such as extension, language, family, and more.',
13
+ author='APIVerve',
14
+ author_email='hello@apiverve.com',
15
+ url='https://apiverve.com/marketplace/codedetector?utm_source=pypi&utm_medium=homepage',
16
+ classifiers=[
17
+ 'Programming Language :: Python :: 3',
18
+ 'Operating System :: OS Independent',
19
+ ],
20
+ python_requires='>=3.6',
21
+ )
@@ -0,0 +1 @@
1
+ # Initialize test module
@@ -0,0 +1,19 @@
1
+ import unittest
2
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient
3
+
4
+ class TestClient(unittest.TestCase):
5
+
6
+ def setUp(self):
7
+ self.api_key = 'test_api_key'
8
+ self.client = CodedetectorAPIClient(self.api_key)
9
+
10
+ def test_get(self):
11
+ # Assuming there's an endpoint 'test_endpoint' for testing purposes
12
+ try:
13
+ response = self.client.get('test_endpoint')
14
+ self.assertIsInstance(response, dict)
15
+ except Exception as e:
16
+ self.fail(f"GET request failed with exception {e}")
17
+
18
+ if __name__ == '__main__':
19
+ unittest.main()
@@ -0,0 +1,369 @@
1
+ Metadata-Version: 2.4
2
+ Name: apiverve-codedetector
3
+ Version: 1.1.14
4
+ Summary: Code Detector is a simple tool for detecting the language of code in text. It returns details such as extension, language, family, and more.
5
+ Author-email: APIVerve <hello@apiverve.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://apiverve.com?utm_source=pypi
8
+ Project-URL: Repository, https://github.com/apiverve/codedetector-api
9
+ Project-URL: Documentation, https://docs.apiverve.com/api/codedetector?utm_source=pypi
10
+ Project-URL: Twitter, https://twitter.com/apivervehq
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: Intended Audience :: Healthcare Industry
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Intended Audience :: Information Technology
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Utilities
22
+ Classifier: Topic :: Scientific/Engineering
23
+ Classifier: Topic :: Education
24
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
25
+ Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
26
+ Classifier: Topic :: Internet :: WWW/HTTP
27
+ Classifier: Topic :: Software Development :: Libraries
28
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
29
+ Classifier: Topic :: Internet
30
+ Classifier: Topic :: Communications
31
+ Classifier: Topic :: Office/Business
32
+ Classifier: Topic :: Text Processing
33
+ Classifier: Topic :: Security
34
+ Classifier: Topic :: Database
35
+ Classifier: Topic :: Software Development :: Code Generators
36
+ Classifier: Topic :: Software Development :: Pre-processors
37
+ Classifier: Topic :: Software Development :: Quality Assurance
38
+ Classifier: Topic :: Software Development :: Testing
39
+ Classifier: Natural Language :: English
40
+ Requires-Python: >=3.7
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: requests>=2.25.0
44
+ Dynamic: license-file
45
+
46
+ Code Detector API
47
+ ============
48
+
49
+ Code Detector is a simple tool for detecting the language of code in text. It returns details such as extension, language, family, and more.
50
+
51
+ ![Build Status](https://img.shields.io/badge/build-passing-green)
52
+ ![Code Climate](https://img.shields.io/badge/maintainability-B-purple)
53
+ ![Prod Ready](https://img.shields.io/badge/production-ready-blue)
54
+
55
+ This is a Python API Wrapper for the [Code Detector API](https://apiverve.com/marketplace/codedetector?utm_source=pypi&utm_medium=readme)
56
+
57
+ ---
58
+
59
+ ## Installation
60
+
61
+ Using `pip`:
62
+
63
+ ```bash
64
+ pip install apiverve-codedetector
65
+ ```
66
+
67
+ Using `pip3`:
68
+
69
+ ```bash
70
+ pip3 install apiverve-codedetector
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Configuration
76
+
77
+ Before using the codedetector API client, you have to setup your account and obtain your API Key.
78
+ You can get it by signing up at [https://apiverve.com](https://apiverve.com?utm_source=pypi&utm_medium=readme)
79
+
80
+ ---
81
+
82
+ ## Quick Start
83
+
84
+ Here's a simple example to get you started quickly:
85
+
86
+ ```python
87
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient
88
+
89
+ # Initialize the client with your APIVerve API key
90
+ api = CodedetectorAPIClient("[YOUR_API_KEY]")
91
+
92
+ query = { "code": "a = 5
93
+ b = 6
94
+ c = 7
95
+
96
+ # calculate the semi-perimeter
97
+ s = (a + b + c) / 2
98
+
99
+ # calculate the area
100
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
101
+ print('The area of the triangle is %0.2f' %area)" }
102
+
103
+ try:
104
+ # Make the API call
105
+ result = api.execute(query)
106
+
107
+ # Print the result
108
+ print(result)
109
+ except Exception as e:
110
+ print(f"Error: {e}")
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Usage
116
+
117
+ The Code Detector API documentation is found here: [https://docs.apiverve.com/ref/codedetector](https://docs.apiverve.com/ref/codedetector?utm_source=pypi&utm_medium=readme).
118
+ You can find parameters, example responses, and status codes documented here.
119
+
120
+ ### Setup
121
+
122
+ ```python
123
+ # Import the client module
124
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient
125
+
126
+ # Initialize the client with your APIVerve API key
127
+ api = CodedetectorAPIClient("[YOUR_API_KEY]")
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Perform Request
133
+
134
+ Using the API client, you can perform requests to the API.
135
+
136
+ ###### Define Query
137
+
138
+ ```python
139
+ query = { "code": "a = 5
140
+ b = 6
141
+ c = 7
142
+
143
+ # calculate the semi-perimeter
144
+ s = (a + b + c) / 2
145
+
146
+ # calculate the area
147
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
148
+ print('The area of the triangle is %0.2f' %area)" }
149
+ ```
150
+
151
+ ###### Simple Request
152
+
153
+ ```python
154
+ # Make a request to the API
155
+ result = api.execute(query)
156
+
157
+ # Print the result
158
+ print(result)
159
+ ```
160
+
161
+ ###### Example Response
162
+
163
+ ```json
164
+ {
165
+ "status": "ok",
166
+ "error": null,
167
+ "data": {
168
+ "likelihood": 0.99,
169
+ "family": "PYTHON",
170
+ "current": "python",
171
+ "readable": "Python Code",
172
+ "extension": ".py"
173
+ }
174
+ }
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Error Handling
180
+
181
+ The API client provides comprehensive error handling through the `CodedetectorAPIClientError` exception. Here are some examples:
182
+
183
+ ### Basic Error Handling
184
+
185
+ ```python
186
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient, CodedetectorAPIClientError
187
+
188
+ api = CodedetectorAPIClient("[YOUR_API_KEY]")
189
+
190
+ query = { "code": "a = 5
191
+ b = 6
192
+ c = 7
193
+
194
+ # calculate the semi-perimeter
195
+ s = (a + b + c) / 2
196
+
197
+ # calculate the area
198
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
199
+ print('The area of the triangle is %0.2f' %area)" }
200
+
201
+ try:
202
+ result = api.execute(query)
203
+ print("Success!")
204
+ print(result)
205
+ except CodedetectorAPIClientError as e:
206
+ print(f"API Error: {e.message}")
207
+ if e.status_code:
208
+ print(f"Status Code: {e.status_code}")
209
+ if e.response:
210
+ print(f"Response: {e.response}")
211
+ ```
212
+
213
+ ### Handling Specific Error Types
214
+
215
+ ```python
216
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient, CodedetectorAPIClientError
217
+
218
+ api = CodedetectorAPIClient("[YOUR_API_KEY]")
219
+
220
+ query = { "code": "a = 5
221
+ b = 6
222
+ c = 7
223
+
224
+ # calculate the semi-perimeter
225
+ s = (a + b + c) / 2
226
+
227
+ # calculate the area
228
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
229
+ print('The area of the triangle is %0.2f' %area)" }
230
+
231
+ try:
232
+ result = api.execute(query)
233
+
234
+ # Check for successful response
235
+ if result.get('status') == 'success':
236
+ print("Request successful!")
237
+ print(result.get('data'))
238
+ else:
239
+ print(f"API returned an error: {result.get('error')}")
240
+
241
+ except CodedetectorAPIClientError as e:
242
+ # Handle API client errors
243
+ if e.status_code == 401:
244
+ print("Unauthorized: Invalid API key")
245
+ elif e.status_code == 429:
246
+ print("Rate limit exceeded")
247
+ elif e.status_code >= 500:
248
+ print("Server error - please try again later")
249
+ else:
250
+ print(f"API error: {e.message}")
251
+ except Exception as e:
252
+ # Handle unexpected errors
253
+ print(f"Unexpected error: {str(e)}")
254
+ ```
255
+
256
+ ### Using Context Manager (Recommended)
257
+
258
+ The client supports the context manager protocol for automatic resource cleanup:
259
+
260
+ ```python
261
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient, CodedetectorAPIClientError
262
+
263
+ query = { "code": "a = 5
264
+ b = 6
265
+ c = 7
266
+
267
+ # calculate the semi-perimeter
268
+ s = (a + b + c) / 2
269
+
270
+ # calculate the area
271
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
272
+ print('The area of the triangle is %0.2f' %area)" }
273
+
274
+ # Using context manager ensures proper cleanup
275
+ with CodedetectorAPIClient("[YOUR_API_KEY]") as api:
276
+ try:
277
+ result = api.execute(query)
278
+ print(result)
279
+ except CodedetectorAPIClientError as e:
280
+ print(f"Error: {e.message}")
281
+ # Session is automatically closed here
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Advanced Features
287
+
288
+ ### Debug Mode
289
+
290
+ Enable debug logging to see detailed request and response information:
291
+
292
+ ```python
293
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient
294
+
295
+ # Enable debug mode
296
+ api = CodedetectorAPIClient("[YOUR_API_KEY]", debug=True)
297
+
298
+ query = { "code": "a = 5
299
+ b = 6
300
+ c = 7
301
+
302
+ # calculate the semi-perimeter
303
+ s = (a + b + c) / 2
304
+
305
+ # calculate the area
306
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
307
+ print('The area of the triangle is %0.2f' %area)" }
308
+
309
+ # Debug information will be printed to console
310
+ result = api.execute(query)
311
+ ```
312
+
313
+ ### Manual Session Management
314
+
315
+ If you need to manually manage the session lifecycle:
316
+
317
+ ```python
318
+ from apiverve_codedetector.apiClient import CodedetectorAPIClient
319
+
320
+ api = CodedetectorAPIClient("[YOUR_API_KEY]")
321
+
322
+ query = { "code": "a = 5
323
+ b = 6
324
+ c = 7
325
+
326
+ # calculate the semi-perimeter
327
+ s = (a + b + c) / 2
328
+
329
+ # calculate the area
330
+ area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
331
+ print('The area of the triangle is %0.2f' %area)" }
332
+
333
+ try:
334
+ result = api.execute(query)
335
+ print(result)
336
+ finally:
337
+ # Manually close the session when done
338
+ api.close()
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Customer Support
344
+
345
+ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact?utm_source=pypi&utm_medium=readme).
346
+
347
+ ---
348
+
349
+ ## Updates
350
+ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
351
+
352
+ ---
353
+
354
+ ## Legal
355
+
356
+ All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms?utm_source=pypi&utm_medium=readme) and all legal documents and agreements.
357
+
358
+ ---
359
+
360
+ ## License
361
+ Licensed under the The MIT License (MIT)
362
+
363
+ Copyright (&copy;) 2026 APIVerve, and EvlarSoft LLC
364
+
365
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
366
+
367
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
368
+
369
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ apiverve_codedetector/__init__.py,sha256=rZPtMVLbzdHEoOTsW1mgGeXuu2kDLSGVVlkXBgquYwc,139
2
+ apiverve_codedetector/apiClient.py,sha256=yJfD-_frQPlOFPPVfUgOZ4FVVV1FCn_TLTJy761h3oY,9988
3
+ apiverve_codedetector/exceptions.py,sha256=7b_cBVeUMJcNEPLVN_1toFy6APlF_XNqxv570n_GgmE,107
4
+ apiverve_codedetector/setup.py,sha256=jNukGqGsa4R46_xb1zz_qVC1ASyM_L9PAaxa2XRGg9U,1026
5
+ apiverve_codedetector/setup_dep.py,sha256=5L2spKimHH_CyKqgDLL3uETSjW_nNIQYh6HV3pCycFc,725
6
+ apiverve_codedetector/tests/__init__.py,sha256=w6P0tAvlmu3OJbVjWR0J1p1bxOlrB2LqnMv2tigQCu4,26
7
+ apiverve_codedetector/tests/test_api.py,sha256=F2rBnqtTsuztngt8y0a8BEcNyVGfLWQGo_fEMHsnVR4,620
8
+ apiverve_codedetector-1.1.14.dist-info/licenses/LICENSE,sha256=YsfLd-GMs4-ZhMK0ecz-_Jr9DX9cPphkby5JVKaPgEY,1109
9
+ apiverve_codedetector-1.1.14.dist-info/METADATA,sha256=SQ9DbMFeFkRHJDj2oaX_cwfY7KhBT2C_ScpZNlWOps0,10460
10
+ apiverve_codedetector-1.1.14.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
11
+ apiverve_codedetector-1.1.14.dist-info/top_level.txt,sha256=OrQe_Ik8_uk00vVdUL9KXOun335egSbFZm6lB3XfLc8,22
12
+ apiverve_codedetector-1.1.14.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 APIVerve, and Evlar LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ apiverve_codedetector