Skip to content

Commit 8829d9c

Browse files
committed
http: header: add default User-Agent header
As customary with API libraries, it is useful for server operators to know which library makes requests to it. This sets the default to the library + version. Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
1 parent 5bb1b71 commit 8829d9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

overpy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ class Overpass:
7575
#: Default URL of the Overpass server
7676
default_url: ClassVar[str] = "http://overpass-api.de/api/interpreter"
7777

78-
default_headers: ClassVar[Dict[str, str]] = {}
78+
default_headers: ClassVar[Dict[str, str]] = {
79+
'User-Agent': 'python-overpy/{} (urllib)'.format(__version__),
80+
}
7981

8082
def __init__(
8183
self,

0 commit comments

Comments
 (0)