-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrocketapi.py
More file actions
27 lines (22 loc) · 810 Bytes
/
rocketapi.py
File metadata and controls
27 lines (22 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
class RocketAPI:
def __init__(self, token, max_timeout=30):
"""
RocketAPI client.
If your base_url is different from the default, you can reassign it after initialization.
For more information, see documentation: https://docs.rocketapi.io/api/
"""
self.base_url = "https://v1.rocketapi.io/"
self.version = "1.0.12"
self.token = token
self.max_timeout = max_timeout
def request(self, method, data):
return requests.post(
url=self.base_url + method,
json=data,
headers={
"Authorization": f"Token {self.token}",
"User-Agent": f"RocketAPI Python SDK/{self.version}",
},
timeout=self.max_timeout,
).json()