codegyan 0.1.0__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.
- codegyan-0.1.0.dist-info/METADATA +56 -0
- codegyan-0.1.0.dist-info/RECORD +8 -0
- codegyan-0.1.0.dist-info/WHEEL +5 -0
- codegyan-0.1.0.dist-info/top_level.txt +1 -0
- src/__init__.py +12 -0
- src/client.py +11 -0
- src/compiler.py +20 -0
- src/tools.py +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: codegyan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python library to interact with the Codegyan API
|
|
5
|
+
Home-page: https://github.com/prathmeshyelne/codegyan-python
|
|
6
|
+
Author: Prathmesh Yelne
|
|
7
|
+
Author-email: prathmeshyelne@codegyan.in
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
|
|
15
|
+
# Codegyan Python Library
|
|
16
|
+
|
|
17
|
+
A Python library to interact with the Codegyan API.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install codegyan
|
|
23
|
+
```
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from codegyan import Codegyan
|
|
28
|
+
|
|
29
|
+
client = Codegyan(api_key='your_api_key', client_id='your_client_id')
|
|
30
|
+
|
|
31
|
+
# Compiler API
|
|
32
|
+
result = client.compilerApiClient.compile(lang='python', code='print("Hello, World!")')
|
|
33
|
+
print(result)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Testing
|
|
38
|
+
|
|
39
|
+
Create test files in the `tests` directory to ensure your library works as expected.
|
|
40
|
+
|
|
41
|
+
#### `tests/test_compiler.py`
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import unittest
|
|
45
|
+
from codegyan.compiler import CompilerApiClient
|
|
46
|
+
|
|
47
|
+
class TestCompilerApiClient(unittest.TestCase):
|
|
48
|
+
def setUp(self):
|
|
49
|
+
self.client = CompilerApiClient(api_key='your_api_key', client_id='your_client_id')
|
|
50
|
+
|
|
51
|
+
def test_compile(self):
|
|
52
|
+
result = self.client.compile(lang='python', code='print("Hello, World!")')
|
|
53
|
+
self.assertIn('output', result)
|
|
54
|
+
|
|
55
|
+
if __name__ == '__main__':
|
|
56
|
+
unittest.main()
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
src/__init__.py,sha256=_JVPrSRQ6MRvniPWAXc3qpqxLu7EY1C5JDq75Tz5CBE,448
|
|
2
|
+
src/client.py,sha256=UnvgluF1EVrUYoYJJtVa-x_W29qqM6SZ40olpAEOAS4,508
|
|
3
|
+
src/compiler.py,sha256=q9tpdVBt9BtNr-LM9IkPBtGBRSWCjEVRZNdde9Hs7C0,575
|
|
4
|
+
src/tools.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
codegyan-0.1.0.dist-info/METADATA,sha256=_XcZ_lcaV1lVFWtemMLMlNdPDlH3Y0j_Hgwgby37yfM,1413
|
|
6
|
+
codegyan-0.1.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
7
|
+
codegyan-0.1.0.dist-info/top_level.txt,sha256=74rtVfumQlgAPzR5_2CgYN24MB0XARCg0t-gzk6gTrM,4
|
|
8
|
+
codegyan-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src
|
src/__init__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# codegyan/__init__.py
|
|
2
|
+
|
|
3
|
+
# Import the main class or functions that you want to expose directly when the package is imported
|
|
4
|
+
from .client import Codegyan
|
|
5
|
+
|
|
6
|
+
# Optionally, you can import specific API clients if needed
|
|
7
|
+
# from .compiler import CodeGyanCompilerApiClient
|
|
8
|
+
# from .tools import CodeGyanToolsApiClient
|
|
9
|
+
# from .articles import CodeGyanArticlesApiClient
|
|
10
|
+
|
|
11
|
+
# List what should be imported when using "from codegyan import *"
|
|
12
|
+
__all__ = ['Codegyan']
|
src/client.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .compiler import CompilerApiClient
|
|
2
|
+
# from .tools_api_client import ToolsApiClient
|
|
3
|
+
# from .articles_api_client import ArticlesApiClient
|
|
4
|
+
|
|
5
|
+
class Codegyan:
|
|
6
|
+
def __init__(self, api_key, client_id):
|
|
7
|
+
self.api_key = api_key
|
|
8
|
+
self.client_id = client_id
|
|
9
|
+
self.compilerApiClient = CompilerApiClient(self.api_key, self.client_id)
|
|
10
|
+
# self.toolsApiClient = ToolsApiClient(self.api_key, self.client_id)
|
|
11
|
+
# self.articlesApiClient = ArticlesApiClient(self.api_key, self.client_id)
|
src/compiler.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class CompilerApiClient:
|
|
4
|
+
def __init__(self, api_key, client_id):
|
|
5
|
+
self.api_key = api_key
|
|
6
|
+
self.client_id = client_id
|
|
7
|
+
self.base_url = 'https://api.codegyan.in/v2/compiler'
|
|
8
|
+
|
|
9
|
+
def compile(self, lang, code):
|
|
10
|
+
url = f'{self.base_url}/compile'
|
|
11
|
+
headers = {
|
|
12
|
+
'APIKey': self.api_key,
|
|
13
|
+
'ClientID': self.client_id
|
|
14
|
+
}
|
|
15
|
+
data = {
|
|
16
|
+
'language': lang,
|
|
17
|
+
'code': code
|
|
18
|
+
}
|
|
19
|
+
response = requests.post(url, headers=headers, json=data)
|
|
20
|
+
return response.json()
|
src/tools.py
ADDED
|
File without changes
|