Skip to content

Commit

Permalink
customize user agent from system environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ivyxjc authored and tylerflex committed Sep 20, 2023
1 parent 3d1211b commit ecee5fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ the nonuniform grid, as well as and the propagation axis direction for modes in
- Bug with truly anisotropic `JaxCustomMedium` in adjoint plugin.
- Bug in adjoint plugin when `JaxBox` is less than 1 grid cell thick.
- Bug in `adjoint` plugin where `JaxSimulation.structures` did not accept structures containing `td.PolySlab`.
- Return empty list if the folder cannot be queried in `web.get_tasks()`.

### Fixed
- Filtering based on `ModeSpec.filter_pol` now uses the user-exposed `ModeSolverData.pol_fraction` property. This also fixes the previous internal handling which was not taking the nonuniform grid, as well as and the propagation axis direction for modes in angled waveguides. In practice, the results should be similar in most cases.

## [2.4.0] - 2023-9-11

Expand Down
8 changes: 4 additions & 4 deletions tidy3d/web/http_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

SIMCLOUD_APIKEY = "SIMCLOUD_APIKEY"

USER_AGENT = os.environ.get("TIDY3D_AGENT", f"Python-Client/{__version__}")


class ResponseCodes(Enum):
"""HTTP response codes to handle individually."""
Expand Down Expand Up @@ -64,6 +66,7 @@ def api_key_auth(request: requests.request) -> requests.request:
request.headers["simcloud-api-key"] = key
request.headers["tidy3d-python-version"] = __version__
request.headers["source"] = "Python"
request.headers["User-Agent"] = USER_AGENT
return request


Expand All @@ -75,10 +78,7 @@ def get_headers() -> Dict[str, str]:
Dict[str, str]
dictionary with "Authorization" and "Application" keys.
"""
return {
"simcloud-api-key": api_key(),
"Application": "TIDY3D",
}
return {"simcloud-api-key": api_key(), "Application": "TIDY3D", "User-Agent": USER_AGENT}


def http_interceptor(func):
Expand Down

0 comments on commit ecee5fa

Please sign in to comment.