We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32d9724 commit b1d23c8Copy full SHA for b1d23c8
vulnerablecode/http.py
@@ -0,0 +1,8 @@
1
+import requests
2
+from vulnerablecode.settings import VULNERABLECODE_USER_AGENT
3
+
4
5
+def get(url, **kwargs):
6
+ headers = kwargs.pop("headers", {})
7
+ headers.setdefault("User-Agent", VULNERABLECODE_USER_AGENT)
8
+ return requests.get(url, headers=headers, **kwargs)
vulnerablecode/settings.py
@@ -385,3 +385,10 @@
385
"DEFAULT_TIMEOUT": env.int("VULNERABLECODE_REDIS_DEFAULT_TIMEOUT", default=3600),
386
}
387
388
389
+import os
390
391
+VULNERABLECODE_USER_AGENT = os.getenv(
392
+ "VULNERABLECODE_USER_AGENT",
393
+ "VulnerableCode"
394
+)
0 commit comments