apiverve-rockpaperscissors 1.1.14__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.
@@ -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,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: apiverve-rockpaperscissors
3
+ Version: 1.1.14
4
+ Summary: Rock Paper Scissors API simulates the classic hand game with detailed outcome analysis, statistics, and support for multiple rounds.
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/rockpaperscissors-api
9
+ Project-URL: Documentation, https://docs.apiverve.com/api/rockpaperscissors?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
+ Rock Paper Scissors API
47
+ ============
48
+
49
+ Rock Paper Scissors API simulates the classic hand game with detailed outcome analysis, statistics, and support for multiple rounds.
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 [Rock Paper Scissors API](https://apiverve.com/marketplace/rockpaperscissors?utm_source=pypi&utm_medium=readme)
56
+
57
+ ---
58
+
59
+ ## Installation
60
+
61
+ Using `pip`:
62
+
63
+ ```bash
64
+ pip install apiverve-rockpaperscissors
65
+ ```
66
+
67
+ Using `pip3`:
68
+
69
+ ```bash
70
+ pip3 install apiverve-rockpaperscissors
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Configuration
76
+
77
+ Before using the rockpaperscissors 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_rockpaperscissors.apiClient import RockpaperscissorsAPIClient
88
+
89
+ # Initialize the client with your APIVerve API key
90
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]")
91
+
92
+ query = {
93
+ "choice": "random",
94
+ "rounds": 1
95
+ }
96
+
97
+ try:
98
+ # Make the API call
99
+ result = api.execute(query)
100
+
101
+ # Print the result
102
+ print(result)
103
+ except Exception as e:
104
+ print(f"Error: {e}")
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Usage
110
+
111
+ The Rock Paper Scissors API documentation is found here: [https://docs.apiverve.com/ref/rockpaperscissors](https://docs.apiverve.com/ref/rockpaperscissors?utm_source=pypi&utm_medium=readme).
112
+ You can find parameters, example responses, and status codes documented here.
113
+
114
+ ### Setup
115
+
116
+ ```python
117
+ # Import the client module
118
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient
119
+
120
+ # Initialize the client with your APIVerve API key
121
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]")
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Perform Request
127
+
128
+ Using the API client, you can perform requests to the API.
129
+
130
+ ###### Define Query
131
+
132
+ ```python
133
+ query = {
134
+ "choice": "random",
135
+ "rounds": 1
136
+ }
137
+ ```
138
+
139
+ ###### Simple Request
140
+
141
+ ```python
142
+ # Make a request to the API
143
+ result = api.execute(query)
144
+
145
+ # Print the result
146
+ print(result)
147
+ ```
148
+
149
+ ###### Example Response
150
+
151
+ ```json
152
+ {
153
+ "status": "ok",
154
+ "error": null,
155
+ "data": {
156
+ "total_rounds": 5,
157
+ "player_choice_mode": "manual",
158
+ "games": [
159
+ {
160
+ "round": 1,
161
+ "player_choice": "rock",
162
+ "player_emoji": "🪨",
163
+ "computer_choice": "paper",
164
+ "computer_emoji": "📄",
165
+ "outcome": "computer",
166
+ "message": "Computer wins! undefined"
167
+ },
168
+ {
169
+ "round": 2,
170
+ "player_choice": "rock",
171
+ "player_emoji": "🪨",
172
+ "computer_choice": "paper",
173
+ "computer_emoji": "📄",
174
+ "outcome": "computer",
175
+ "message": "Computer wins! undefined"
176
+ },
177
+ {
178
+ "round": 3,
179
+ "player_choice": "rock",
180
+ "player_emoji": "🪨",
181
+ "computer_choice": "rock",
182
+ "computer_emoji": "🪨",
183
+ "outcome": "tie",
184
+ "message": "It's a tie! Both chose rock"
185
+ },
186
+ {
187
+ "round": 4,
188
+ "player_choice": "rock",
189
+ "player_emoji": "🪨",
190
+ "computer_choice": "scissors",
191
+ "computer_emoji": "✂️",
192
+ "outcome": "player",
193
+ "message": "You win! Rock crushes scissors"
194
+ },
195
+ {
196
+ "round": 5,
197
+ "player_choice": "rock",
198
+ "player_emoji": "🪨",
199
+ "computer_choice": "paper",
200
+ "computer_emoji": "📄",
201
+ "outcome": "computer",
202
+ "message": "Computer wins! undefined"
203
+ }
204
+ ],
205
+ "results": {
206
+ "player_wins": 1,
207
+ "computer_wins": 3,
208
+ "ties": 1,
209
+ "player_win_percentage": 20,
210
+ "computer_win_percentage": 60,
211
+ "tie_percentage": 20
212
+ },
213
+ "overall_winner": "computer",
214
+ "game_rules": {
215
+ "rock_beats": "scissors",
216
+ "paper_beats": "rock",
217
+ "scissors_beats": "paper"
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Error Handling
226
+
227
+ The API client provides comprehensive error handling through the `RockpaperscissorsAPIClientError` exception. Here are some examples:
228
+
229
+ ### Basic Error Handling
230
+
231
+ ```python
232
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient, RockpaperscissorsAPIClientError
233
+
234
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]")
235
+
236
+ query = {
237
+ "choice": "random",
238
+ "rounds": 1
239
+ }
240
+
241
+ try:
242
+ result = api.execute(query)
243
+ print("Success!")
244
+ print(result)
245
+ except RockpaperscissorsAPIClientError as e:
246
+ print(f"API Error: {e.message}")
247
+ if e.status_code:
248
+ print(f"Status Code: {e.status_code}")
249
+ if e.response:
250
+ print(f"Response: {e.response}")
251
+ ```
252
+
253
+ ### Handling Specific Error Types
254
+
255
+ ```python
256
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient, RockpaperscissorsAPIClientError
257
+
258
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]")
259
+
260
+ query = {
261
+ "choice": "random",
262
+ "rounds": 1
263
+ }
264
+
265
+ try:
266
+ result = api.execute(query)
267
+
268
+ # Check for successful response
269
+ if result.get('status') == 'success':
270
+ print("Request successful!")
271
+ print(result.get('data'))
272
+ else:
273
+ print(f"API returned an error: {result.get('error')}")
274
+
275
+ except RockpaperscissorsAPIClientError as e:
276
+ # Handle API client errors
277
+ if e.status_code == 401:
278
+ print("Unauthorized: Invalid API key")
279
+ elif e.status_code == 429:
280
+ print("Rate limit exceeded")
281
+ elif e.status_code >= 500:
282
+ print("Server error - please try again later")
283
+ else:
284
+ print(f"API error: {e.message}")
285
+ except Exception as e:
286
+ # Handle unexpected errors
287
+ print(f"Unexpected error: {str(e)}")
288
+ ```
289
+
290
+ ### Using Context Manager (Recommended)
291
+
292
+ The client supports the context manager protocol for automatic resource cleanup:
293
+
294
+ ```python
295
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient, RockpaperscissorsAPIClientError
296
+
297
+ query = {
298
+ "choice": "random",
299
+ "rounds": 1
300
+ }
301
+
302
+ # Using context manager ensures proper cleanup
303
+ with RockpaperscissorsAPIClient("[YOUR_API_KEY]") as api:
304
+ try:
305
+ result = api.execute(query)
306
+ print(result)
307
+ except RockpaperscissorsAPIClientError as e:
308
+ print(f"Error: {e.message}")
309
+ # Session is automatically closed here
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Advanced Features
315
+
316
+ ### Debug Mode
317
+
318
+ Enable debug logging to see detailed request and response information:
319
+
320
+ ```python
321
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient
322
+
323
+ # Enable debug mode
324
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]", debug=True)
325
+
326
+ query = {
327
+ "choice": "random",
328
+ "rounds": 1
329
+ }
330
+
331
+ # Debug information will be printed to console
332
+ result = api.execute(query)
333
+ ```
334
+
335
+ ### Manual Session Management
336
+
337
+ If you need to manually manage the session lifecycle:
338
+
339
+ ```python
340
+ from apiverve_rockpaperscissors.apiClient import RockpaperscissorsAPIClient
341
+
342
+ api = RockpaperscissorsAPIClient("[YOUR_API_KEY]")
343
+
344
+ query = {
345
+ "choice": "random",
346
+ "rounds": 1
347
+ }
348
+
349
+ try:
350
+ result = api.execute(query)
351
+ print(result)
352
+ finally:
353
+ # Manually close the session when done
354
+ api.close()
355
+ ```
356
+
357
+ ---
358
+
359
+ ## Customer Support
360
+
361
+ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact?utm_source=pypi&utm_medium=readme).
362
+
363
+ ---
364
+
365
+ ## Updates
366
+ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Twitter.
367
+
368
+ ---
369
+
370
+ ## Legal
371
+
372
+ 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.
373
+
374
+ ---
375
+
376
+ ## License
377
+ Licensed under the The MIT License (MIT)
378
+
379
+ Copyright (&copy;) 2026 APIVerve, and EvlarSoft LLC
380
+
381
+ 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:
382
+
383
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
384
+
385
+ 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.