Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

TOSession - Error when calling TOSession.get_parameters_by_profile_id  #6589

@davidc0le

Description

@davidc0le

This Bug Report affects these Traffic Control components:

  • Traffic Control Client - Python

Current behavior:

When calling TOSession.get_parameters_by_profile_id with a valid profile_id, an error is received. The code used was as follows:

    with TOSession(ats_host, verify_cert=verify_cert) as traffic_ops_api:
        traffic_ops_api.login(to_user, to_pass)
        profiles = traffic_ops_api.get_profiles()[0]
        src = profiles[1] 
        params = traffic_ops_api.get_parameters_by_profile_id(profile_id=src.id)

And the error:

ERROR:trafficops.restapi:restapi.py:_build_endpoint:344: Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']
ERROR:root:Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']
Traceback (most recent call last):
File "/path/to/apache-trafficcontrol-6.0.2/traffic_control/clients/python/trafficops/restapi.py", line 339, in _build_endpoint
new_api_path = api_path.format(**url_params) + qparams
KeyError: 'id'

ValueError: Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']

The decorator for method get_parameters_by_profile_id is using a different variable to the one defined in the method ( profile_id vs id ).

Expected behavior:

A list of parameters should be returned.

Steps to reproduce:

The following code could be used to reproduce the issue:

    with TOSession(ats_host, verify_cert=verify_cert) as traffic_ops_api:
        traffic_ops_api.login(to_user, to_pass)
        profiles = traffic_ops_api.get_profiles()[0]
        src = profiles[1] 
        params = traffic_ops_api.get_parameters_by_profile_id(profile_id=src.id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    TC Client (python)related to the Python implementation of a TC clientbugsomething isn't working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions