chatady 1.0.1__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.
chatady-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ARCLOOP LIMITED
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.
chatady-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.1
2
+ Name: chatady
3
+ Version: 1.0.1
4
+ Summary: A Python wrapper for the ChatADy API.
5
+ Author-email: Jernej Pregelj <contact@chatady.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 ARCLOOP LIMITED
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/ChatADy/chatady-python
29
+ Keywords: chatady,api,wrapper
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Programming Language :: Python
32
+ Classifier: Programming Language :: Python :: 3
33
+ Requires-Python: >=3.6
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: request
37
+ Provides-Extra: dev
38
+ Requires-Dist: black; extra == "dev"
39
+ Requires-Dist: bumpver; extra == "dev"
40
+ Requires-Dist: isort; extra == "dev"
41
+ Requires-Dist: pip-tools; extra == "dev"
42
+ Requires-Dist: pytest; extra == "dev"
43
+
44
+ # ChatADy Package for Python
45
+
46
+ The `ChatADy` package is a Python wrapper for the ChatADy API, facilitating easy interaction with ChatADy's services from Python applications. It provides methods to retrieve contents and initiate new chats.
47
+
48
+ ## Installation
49
+
50
+ To install ChatADy, run this command in your terminal:
51
+
52
+ ```bash
53
+ pip install chatady
54
+ ```
55
+
56
+ This is the preferred method to install ChatADy, as it will always install the most recent stable release.
57
+
58
+ If you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.
59
+
60
+ ## Usage
61
+
62
+ To use the `ChatADy` package, you first need to import the `ChatADy` class from the package and then initialize it with your publisher ID and key.
63
+
64
+ ### Quick Start
65
+
66
+ Here's a quick example to get you started:
67
+
68
+ ```python
69
+ from chatady.chatady import ChatADy
70
+
71
+ # Initialize the ChatADy client
72
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
73
+
74
+ # Send in messages
75
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='your_entry_message', human='boolean_human_or_bot')
76
+ print(response)
77
+
78
+ # Get ad contents
79
+ response = client.get_contents(chat_id='unique_id_identifying_conversation')
80
+ print(response)
81
+ ```
82
+
83
+ ### Initializing the Client
84
+
85
+ To interact with the API, you need to create an instance of `ChatADy`:
86
+
87
+ ```python
88
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
89
+ ```
90
+
91
+ You can also pass additional options as a dictionary to configure the client further:
92
+
93
+ ```python
94
+ options = {'environment': 'production', 'noDelay': True, 'timeout': 1000}
95
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key', options=options)
96
+ ```
97
+
98
+ ### Retrieving Ad Contents
99
+
100
+ To retrieve contents, use the `get_contents` method with the chat ID. You can also specify options for filtering:
101
+
102
+ ```python
103
+ response = client.get_contents(chat_id='unique_id_identifying_conversation', options={'humansex': 'male', 'botsex': 'female'})
104
+ print(response)
105
+ ```
106
+
107
+ ### Sending in a New Message
108
+
109
+ To start a new chat, use the `new_chat` method with the chat ID, entry message, and human identifier:
110
+
111
+ ```python
112
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='Hello, ChatADy!', human='boolean_human_or_bot')
113
+ print(response)
114
+ ```
115
+
116
+ ## Support
117
+
118
+ For issues, questions, or contributions, please open an issue on the GitHub repository.
119
+
120
+ ## License
121
+
122
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,79 @@
1
+ # ChatADy Package for Python
2
+
3
+ The `ChatADy` package is a Python wrapper for the ChatADy API, facilitating easy interaction with ChatADy's services from Python applications. It provides methods to retrieve contents and initiate new chats.
4
+
5
+ ## Installation
6
+
7
+ To install ChatADy, run this command in your terminal:
8
+
9
+ ```bash
10
+ pip install chatady
11
+ ```
12
+
13
+ This is the preferred method to install ChatADy, as it will always install the most recent stable release.
14
+
15
+ If you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.
16
+
17
+ ## Usage
18
+
19
+ To use the `ChatADy` package, you first need to import the `ChatADy` class from the package and then initialize it with your publisher ID and key.
20
+
21
+ ### Quick Start
22
+
23
+ Here's a quick example to get you started:
24
+
25
+ ```python
26
+ from chatady.chatady import ChatADy
27
+
28
+ # Initialize the ChatADy client
29
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
30
+
31
+ # Send in messages
32
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='your_entry_message', human='boolean_human_or_bot')
33
+ print(response)
34
+
35
+ # Get ad contents
36
+ response = client.get_contents(chat_id='unique_id_identifying_conversation')
37
+ print(response)
38
+ ```
39
+
40
+ ### Initializing the Client
41
+
42
+ To interact with the API, you need to create an instance of `ChatADy`:
43
+
44
+ ```python
45
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
46
+ ```
47
+
48
+ You can also pass additional options as a dictionary to configure the client further:
49
+
50
+ ```python
51
+ options = {'environment': 'production', 'noDelay': True, 'timeout': 1000}
52
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key', options=options)
53
+ ```
54
+
55
+ ### Retrieving Ad Contents
56
+
57
+ To retrieve contents, use the `get_contents` method with the chat ID. You can also specify options for filtering:
58
+
59
+ ```python
60
+ response = client.get_contents(chat_id='unique_id_identifying_conversation', options={'humansex': 'male', 'botsex': 'female'})
61
+ print(response)
62
+ ```
63
+
64
+ ### Sending in a New Message
65
+
66
+ To start a new chat, use the `new_chat` method with the chat ID, entry message, and human identifier:
67
+
68
+ ```python
69
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='Hello, ChatADy!', human='boolean_human_or_bot')
70
+ print(response)
71
+ ```
72
+
73
+ ## Support
74
+
75
+ For issues, questions, or contributions, please open an issue on the GitHub repository.
76
+
77
+ ## License
78
+
79
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,32 @@
1
+ # pyproject.toml
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=61.0.0", "wheel"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "chatady"
9
+ version = "1.0.1"
10
+ description = "A Python wrapper for the ChatADy API."
11
+ readme = "README.md"
12
+ authors = [{ name = "Jernej Pregelj", email = "contact@chatady.com" }]
13
+ license = { file = "LICENSE" }
14
+ classifiers = [
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3",
18
+ ]
19
+ keywords = ["chatady", "api", "wrapper"]
20
+ dependencies = [
21
+ "request"
22
+ ]
23
+ requires-python = ">=3.6"
24
+
25
+ [project.optional-dependencies]
26
+ dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/ChatADy/chatady-python"
30
+
31
+ [project.scripts]
32
+ realpython = "chatady.__main__:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,48 @@
1
+ import requests
2
+ import json
3
+
4
+ class ChatADy:
5
+ def __init__(self, publisher_id, key, options=None):
6
+ if options is None:
7
+ options = {}
8
+ self.publisher_id = publisher_id
9
+ self.key = key
10
+ self.options = {'environment': 'production', 'noDelay': True, 'timeout': 1000}
11
+ self.options.update(options)
12
+ self.hostname = 'backend.chatady.com'
13
+ self.port = 443
14
+ self.prepath = '/api/v1'
15
+
16
+ def get_contents(self, chat_id, options=None):
17
+ if options is None:
18
+ options = {'humansex': None, 'botsex': None}
19
+ query = '?'
20
+ if options.get('humansex'):
21
+ query += f"humansex={options['humansex']}&"
22
+ if options.get('botsex'):
23
+ query += f"botsex={options['botsex']}"
24
+
25
+ path = f"{self.prepath}/{'contents' if self.options['environment'] == 'production' else 'test-contents'}/{self.publisher_id}/{chat_id}{query}"
26
+ url = f"https://{self.hostname}:{self.port}{path}"
27
+ headers = {
28
+ 'Content-Type': 'application/json',
29
+ 'Authorization': self.key
30
+ }
31
+ response = requests.get(url, headers=headers, timeout=self.options['timeout'])
32
+ print(f"STATUS: {response.status_code}")
33
+ print(f"HEADERS: {response.headers}")
34
+ return response.text
35
+
36
+ def new_chat(self, chat_id, entry, human):
37
+ post_data = json.dumps({'human': human, 'entry': entry})
38
+ path = f"{self.prepath}/{'chats' if self.options['environment'] == 'production' else 'test-chats'}/{self.publisher_id}/{chat_id}"
39
+ url = f"https://{self.hostname}:{self.port}{path}"
40
+ headers = {
41
+ 'Content-Type': 'application/json',
42
+ 'Content-Length': str(len(post_data)),
43
+ 'Authorization': self.key
44
+ }
45
+ response = requests.post(url, headers=headers, data=post_data, timeout=self.options['timeout'])
46
+ print(f"STATUS: {response.status_code}")
47
+ print(f"HEADERS: {response.headers}")
48
+ return response.text
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.1
2
+ Name: chatady
3
+ Version: 1.0.1
4
+ Summary: A Python wrapper for the ChatADy API.
5
+ Author-email: Jernej Pregelj <contact@chatady.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 ARCLOOP LIMITED
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/ChatADy/chatady-python
29
+ Keywords: chatady,api,wrapper
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Programming Language :: Python
32
+ Classifier: Programming Language :: Python :: 3
33
+ Requires-Python: >=3.6
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: request
37
+ Provides-Extra: dev
38
+ Requires-Dist: black; extra == "dev"
39
+ Requires-Dist: bumpver; extra == "dev"
40
+ Requires-Dist: isort; extra == "dev"
41
+ Requires-Dist: pip-tools; extra == "dev"
42
+ Requires-Dist: pytest; extra == "dev"
43
+
44
+ # ChatADy Package for Python
45
+
46
+ The `ChatADy` package is a Python wrapper for the ChatADy API, facilitating easy interaction with ChatADy's services from Python applications. It provides methods to retrieve contents and initiate new chats.
47
+
48
+ ## Installation
49
+
50
+ To install ChatADy, run this command in your terminal:
51
+
52
+ ```bash
53
+ pip install chatady
54
+ ```
55
+
56
+ This is the preferred method to install ChatADy, as it will always install the most recent stable release.
57
+
58
+ If you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.
59
+
60
+ ## Usage
61
+
62
+ To use the `ChatADy` package, you first need to import the `ChatADy` class from the package and then initialize it with your publisher ID and key.
63
+
64
+ ### Quick Start
65
+
66
+ Here's a quick example to get you started:
67
+
68
+ ```python
69
+ from chatady.chatady import ChatADy
70
+
71
+ # Initialize the ChatADy client
72
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
73
+
74
+ # Send in messages
75
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='your_entry_message', human='boolean_human_or_bot')
76
+ print(response)
77
+
78
+ # Get ad contents
79
+ response = client.get_contents(chat_id='unique_id_identifying_conversation')
80
+ print(response)
81
+ ```
82
+
83
+ ### Initializing the Client
84
+
85
+ To interact with the API, you need to create an instance of `ChatADy`:
86
+
87
+ ```python
88
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key')
89
+ ```
90
+
91
+ You can also pass additional options as a dictionary to configure the client further:
92
+
93
+ ```python
94
+ options = {'environment': 'production', 'noDelay': True, 'timeout': 1000}
95
+ client = ChatADy(publisher_id='your_publisher_id', key='your_api_key', options=options)
96
+ ```
97
+
98
+ ### Retrieving Ad Contents
99
+
100
+ To retrieve contents, use the `get_contents` method with the chat ID. You can also specify options for filtering:
101
+
102
+ ```python
103
+ response = client.get_contents(chat_id='unique_id_identifying_conversation', options={'humansex': 'male', 'botsex': 'female'})
104
+ print(response)
105
+ ```
106
+
107
+ ### Sending in a New Message
108
+
109
+ To start a new chat, use the `new_chat` method with the chat ID, entry message, and human identifier:
110
+
111
+ ```python
112
+ response = client.new_chat(chat_id='unique_id_identifying_conversation', entry='Hello, ChatADy!', human='boolean_human_or_bot')
113
+ print(response)
114
+ ```
115
+
116
+ ## Support
117
+
118
+ For issues, questions, or contributions, please open an issue on the GitHub repository.
119
+
120
+ ## License
121
+
122
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/chatady/__init__.py
5
+ src/chatady/chatady.py
6
+ src/chatady.egg-info/PKG-INFO
7
+ src/chatady.egg-info/SOURCES.txt
8
+ src/chatady.egg-info/dependency_links.txt
9
+ src/chatady.egg-info/entry_points.txt
10
+ src/chatady.egg-info/requires.txt
11
+ src/chatady.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ realpython = chatady.__main__:main
@@ -0,0 +1,8 @@
1
+ request
2
+
3
+ [dev]
4
+ black
5
+ bumpver
6
+ isort
7
+ pip-tools
8
+ pytest
@@ -0,0 +1 @@
1
+ chatady