-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathsettings.py
More file actions
38 lines (29 loc) · 1.05 KB
/
settings.py
File metadata and controls
38 lines (29 loc) · 1.05 KB
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
28
29
30
31
32
33
34
35
36
37
38
"""
ipify.settings
~~~~~~~~~~~~~~
This module contains internal settings that make our ipify library simpler.
"""
from platform import mac_ver, win32_ver, release, system
from sys import version_info as vi
from . import __version__
# This is the ipify service base URI. This is where all API requests go.
API_URI = 'https://api.ipify.org'
# The maximum amount of tries to attempt when making API calls.
MAX_TRIES = 3
# This dictionary is used to dynamically select the appropriate platform for
# the user agent string.
OS_VERSION_INFO = {
'Linux': '%s' % (release()),
'Windows': '%s' % (win32_ver()[0]),
'Darwin': '%s' % (mac_ver()[0]),
}
# The user-agent string is provided so that I can (eventually) keep track of
# what libraries to support over time. EG: Maybe the service is used primarily
# by Windows developers, and I should invest more time in improving those
# integrations.
USER_AGENT = 'python-ipify/%s python/%s %s/%s' % (
__version__,
'%s.%s.%s' % (vi.major, vi.minor, vi.micro),
system(),
OS_VERSION_INFO.get(system(), ''),
)