Resolves #194
Add user_agent argument #200
bradh/overpass-api-python-wrapper:0.8.x into 0.8.x Thanks @bradh. Since we're adding a required parameter to the API() constructor, this is a breaking change. There's two ways we can go about this:
- release a 0.8.x version with this (meaningful) change - in that case I would want to add a default value to prevent putting a breaking change in a minor version.
- Since adding the UA is also in the v1.0 plan, we can decide to punt on it.
I'm fine with either - if you want to take the opportunity to dive a little deeper and do some work on the 1.0 branch - please do! Otherwise, we'll release a 0.8.x version soon with the UA parameter + a default value.
The CI failed because you didn't run ruff lint --fix - you couldn't have known since there no developer docs :/ . I am adding contributor documentation and a pre-commit hook to make this process smoother in the future.
For now - you can run scripts/check to run tests and linter - that will also expose one API instantiation in the test where you forgot to add the UA param (line 216)
Also fix formatting
I should have known that, since it was in the DEVELOPMENT.md, and it looks like I did run it (i.e. its in the bash history). I was just too clueless to realise that it was only telling me ruff should reformat it, not that ruff did reformat it.
I've added the default and fixed the formatting problem.
Hey,
I hope it’s not too impolite if I try to piggyback on this PR.
The call to .../status needs to send the User-Agent header now as well. Maybe you could add the headers to the call?
diff --git a/overpass/api.py b/overpass/api.py
index 45796fa..ecfc958 100644
--- a/overpass/api.py
+++ b/overpass/api.py
@@ -248,7 +248,7 @@ class API:
"""
:returns: dict describing the client's status with the API
"""
- r = requests.get(self.status_url)
+ r = requests.get(self.status_url, proxies=self.proxies, headers=self.headers)
lines = tuple(r.text.splitlines())
available_re = re.compile(r"\d(?= slots? available)")
@hfs wrote in #200 (comment):
The call to
.../statusneeds to send the User-Agent header now as well. Maybe you could add the headers to the call?
If we do that, all of the headers (including the response format) will be appended. It'd be a big refactor to change the parsing, so I've just extracted the user agent value and built a new headers dict.
@hfs can you check that meets your use case?
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?