oxrpy 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.
- oxrpy/__init__.py +3 -0
- oxrpy/oxrpy.py +33 -0
- oxrpy-0.1.0.dist-info/METADATA +64 -0
- oxrpy-0.1.0.dist-info/RECORD +7 -0
- oxrpy-0.1.0.dist-info/WHEEL +5 -0
- oxrpy-0.1.0.dist-info/licenses/LICENSE +21 -0
- oxrpy-0.1.0.dist-info/top_level.txt +1 -0
oxrpy/__init__.py
ADDED
oxrpy/oxrpy.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class OxfordAPI:
|
|
4
|
+
def __init__(self, server_id: str, server_key: str):
|
|
5
|
+
self.base_url = "https://api.oxfd.re/v1"
|
|
6
|
+
self.headers = {
|
|
7
|
+
"server-id": server_id,
|
|
8
|
+
"server-key": server_key
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
def get_server(self):
|
|
12
|
+
"""Returns general information about the private server."""
|
|
13
|
+
response = requests.get(f"{self.base_url}/server", headers=self.headers)
|
|
14
|
+
response.raise_for_status()
|
|
15
|
+
return response.json()
|
|
16
|
+
|
|
17
|
+
def get_players(self):
|
|
18
|
+
"""Returns a list of players currently in the server."""
|
|
19
|
+
response = requests.get(f"{self.base_url}/server/players", headers=self.headers)
|
|
20
|
+
response.raise_for_status()
|
|
21
|
+
return response.json()
|
|
22
|
+
|
|
23
|
+
def get_queue(self):
|
|
24
|
+
"""Returns the current reserved server queue."""
|
|
25
|
+
response = requests.get(f"{self.base_url}/server/queue", headers=self.headers)
|
|
26
|
+
response.raise_for_status()
|
|
27
|
+
return response.json()
|
|
28
|
+
|
|
29
|
+
def get_bans(self):
|
|
30
|
+
"""Returns active bans for the server."""
|
|
31
|
+
response = requests.get(f"{self.base_url}/server/bans", headers=self.headers)
|
|
32
|
+
response.raise_for_status()
|
|
33
|
+
return response.json()
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oxrpy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python wrapper for the Oxford RP API
|
|
5
|
+
Project-URL: Homepage, https://github.com/yourusername/oxrpy
|
|
6
|
+
Project-URL: Repository, https://github.com/yourusername/oxrpy
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# oxrpy
|
|
17
|
+
|
|
18
|
+
A Python wrapper for the Oxford RP API.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install from PyPI:
|
|
23
|
+
```
|
|
24
|
+
pip install oxrpy
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or from source:
|
|
28
|
+
```
|
|
29
|
+
pip install -r requirements.txt
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from oxrpy import OxfordAPI
|
|
36
|
+
|
|
37
|
+
# Initialize with your server ID and key
|
|
38
|
+
api = OxfordAPI(server_id="your_server_id", server_key="your_server_key")
|
|
39
|
+
|
|
40
|
+
# Get server information
|
|
41
|
+
server_info = api.get_server()
|
|
42
|
+
print(server_info)
|
|
43
|
+
|
|
44
|
+
# Get current players
|
|
45
|
+
players = api.get_players()
|
|
46
|
+
print(players)
|
|
47
|
+
|
|
48
|
+
# Get queue
|
|
49
|
+
queue = api.get_queue()
|
|
50
|
+
print(queue)
|
|
51
|
+
|
|
52
|
+
# Get bans
|
|
53
|
+
bans = api.get_bans()
|
|
54
|
+
print(bans)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## API Endpoints
|
|
58
|
+
|
|
59
|
+
- `get_server()`: Returns general server information.
|
|
60
|
+
- `get_players()`: Returns list of current players.
|
|
61
|
+
- `get_queue()`: Returns the reserved server queue.
|
|
62
|
+
- `get_bans()`: Returns active bans.
|
|
63
|
+
|
|
64
|
+
All methods return the JSON response from the API.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
oxrpy/__init__.py,sha256=prHGMoeNIVRPSLrWM-XvK5yV1_fwM-PcqYinIv-y7Qg,53
|
|
2
|
+
oxrpy/oxrpy.py,sha256=hmFYrbhlosNuI2CBLPgEDxGqIkHDriS42AE2L0GHBsE,1236
|
|
3
|
+
oxrpy-0.1.0.dist-info/licenses/LICENSE,sha256=8CgvFRvqm1-vN765WXUYlDyJZhnuVhQXe90eW45bZwI,1085
|
|
4
|
+
oxrpy-0.1.0.dist-info/METADATA,sha256=P0jWLuJ8IWnTRT4OoNGb_66AAbdzVdYDpPpgbzaBMr0,1403
|
|
5
|
+
oxrpy-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
oxrpy-0.1.0.dist-info/top_level.txt,sha256=aUvJfy3CkEyv7mrUARPna4XXqFb4qtIcRMcELKQcSAk,6
|
|
7
|
+
oxrpy-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Your Name
|
|
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
|
+
oxrpy
|