Skip to content

Pass documented query string keywords through in ten service class methods - #1532

Open
ajaykr0905 wants to merge 1 commit into
CrowdStrike:devfrom
ajaykr0905:fix/1529-pass-query-keywords
Open

ajaykr0905 wants to merge 1 commit into
CrowdStrike:devfrom
ajaykr0905:fix/1529-pass-query-keywords

Conversation

@ajaykr0905

@ajaykr0905 ajaykr0905 commented Nov 15, 2026 •

Copy link
Copy Markdown

Pass documented query string keywords through

  • Bug fixes
  • Updated unit tests

Ten service class methods document query string keywords that never reached the URL.

Eight of them called process_service_request without keywords=kwargs, so the values were dropped without a warning: RealTimeResponse.init_session (timeout, timeout_duration), Hosts.query_device_login_history_v2 (limit, from, to), NGSIEM.update_data_connection (ids), FirewallManagement.update_network_locations_metadata and update_network_locations_precedence (comment), FalconXSandbox.submit (aid), Agents.create_or_update_agent (wait_for_ready) and AgentInvocation.update_agent_invocation (project_id).

The other two, FirewallManagement.upsert_network_locations (comment) and CustomStorage.upload_version (dry_run), passed keywords but no params dict. args_to_params then raised, and the call returned "Keyword arguments are required to use this method." without sending anything.

I changed all ten to pass keywords=kwargs and params=parameters, following sibling methods such as update_network_locations and CustomStorage.upload. The five methods that had no parameters argument (init_session, create_or_update_agent, update_agent_invocation, upsert_network_locations, upload_version) now take one, added to @force_default, the signature, the docstring and the .pyi stub. Request bodies are unchanged, and this is not a breaking change: body is still the first positional argument and the new argument is keyword-optional.

Unit test coverage

I added tests/test_query_string_keywords.py. For each method it patches requests.request and checks the query string and body the SDK hands to it, both for keywords and for an explicit parameters={...} dict. No network access or credentials are needed. All 21 tests pass; before the change, 15 of them failed. Every changed line is covered by these tests, and the existing mocked suites test_ssl_verify.py and test_non_json_error_responses.py still pass. I couldn't run the full util/run-tests.sh coverage report because it needs API credentials.

Bandit analysis

bandit -r src: No issues identified.

flake8, pylint (--max-line-length=127 --disable=R0801) and pydocstyle are clean on the changed files.

Issues resolved

Other

The issue also mentions CloudAzureRegistration.health_check, FalconContainer.update_registry_entities and two misspelled docstring keywords in the network location metadata and precedence methods. I left those out to keep this PR focused and can follow up separately. I didn't test against a live tenant. The tests check the request the SDK builds.

Ten service class methods documented query string keywords that never
reached the URL. Eight of them called process_service_request without
keywords=kwargs, so the values were dropped:

  RealTimeResponse.init_session (timeout, timeout_duration)
  Hosts.query_device_login_history_v2 (limit, from, to)
  NGSIEM.update_data_connection (ids)
  FirewallManagement.update_network_locations_metadata (comment)
  FirewallManagement.update_network_locations_precedence (comment)
  FalconXSandbox.submit (aid)
  Agents.create_or_update_agent (wait_for_ready)
  AgentInvocation.update_agent_invocation (project_id)

FirewallManagement.upsert_network_locations (comment) and
CustomStorage.upload_version (dry_run) passed keywords but no params
dict, so args_to_params raised and the call returned "Keyword arguments
are required to use this method." without sending anything.

All ten now pass keywords=kwargs and params=parameters. The five
methods without a parameters argument (init_session,
create_or_update_agent, update_agent_invocation,
upsert_network_locations, upload_version) get one in @force_default,
the signature, the docstring and the .pyi stub. Request bodies are
unchanged.

Adds offline unit tests that check the query string and body each
method hands to requests.
@ajaykr0905
ajaykr0905 force-pushed the fix/1529-pass-query-keywords branch from d39e11e to 934285c Compare November 15, 2026 17:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant