Skip to content

Commit ba6a61d

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 <[email protected]>
1 parent 5fcc3b8 commit ba6a61d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

overpy/__init__.py

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

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

8183
def __init__(
8284
self,

0 commit comments

Comments
 (0)