Skip to content

Commit 2564d51

Browse files
Add documentation to IpregistryConfig
This closes #39
1 parent 23b84db commit 2564d51

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ipregistry/core.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,25 @@ def _is_api_error(self, data):
9999

100100
class IpregistryConfig:
101101
def __init__(self, key, base_url="https://api.ipregistry.co", timeout=15):
102+
"""
103+
Initialize the IpregistryConfig instance.
104+
105+
Parameters:
106+
key (str): The API key for accessing the Ipregistry service.
107+
base_url (str): The base URL for the Ipregistry API. Defaults to "https://api.ipregistry.co".
108+
There also exists a European Union (EU) base URL "https://eu.api.ipregistry.co"
109+
that can be used to ensure requests are handled by nodes hosted in the EU only.
110+
timeout (int): The timeout duration (in seconds) for API requests. Defaults to 15 seconds.
111+
"""
102112
self.api_key = key
103113
self.base_url = base_url
104114
self.timeout = timeout
105115

106116
def __str__(self):
107-
return "api_key={}, base_url={}, timeout={}".format(self.api_key, self.base_url, self.timeout)
117+
"""
118+
Return a string representation of the IpregistryConfig instance.
119+
120+
Returns:
121+
str: A string containing the API key, base URL, and timeout value.
122+
"""
123+
return "api_key={}, base_url={}, timeout={}".format(self.api_key, self.base_url, self.timeout)

0 commit comments

Comments
 (0)