Skip to content

Services

Each class below wraps one Congress.gov resource: a get() for the detail endpoint, a search() for the list endpoint, and (where the API supports it) sub-resource getters like get_actions() or get_cosponsors(). See REFERENCE.md for the typical get() identifiers per service, and MEMBERS_QUERY.md for the Members collection's query helpers.

Bill

congressgov.services.bill.Bill

Bill(client: 'AuthenticatedClient | None' = None)

Bases: ApiService

Bill service provides API access for fetching Congressional bill data.

This service class handles API interactions for fetching bills from the Congress.gov API. Once a bill is fetched, instance methods on the Bill model (registered in congressgov.services.extensions.bill) provide additional functionality like expanding attributes and fetching related data.

Separation of Concerns: - This service class: Fetches data from API (get, search) - Bill model extensions: Operate on fetched data (expand, get_actions, etc.) - Bills model extensions: Query and filter collections (filter, by_type, etc.)

USAGE EXAMPLES

Basic usage - fetch a bill

bill_service = Bill(client=my_client) bill = bill_service.get(congress=118, bill_type="hr", bill_number=1)

Now use extension methods on the bill instance

expanded_bill = bill.expand(attributes=['actions', 'cosponsors']) actions = bill.get_actions()

Search for bills

bills = bill_service.search(congress=118, bill_type="hr", limit=10)

Use extension methods on Bills collection

house_bills = bills.by_type("hr") enacted = bills.enacted()

Initialize Bill service.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

Optional API client instance. Can also be provided per-method.

None
Source code in src/congressgov/services/bill.py
104
105
106
107
108
109
110
111
112
def __init__(self, client: 'AuthenticatedClient | None' = None) -> None:
    """
    Initialize Bill service.

    Args:
        client: Optional API client instance. Can also be provided per-method.
    """
    self.client = client
    self._last_result: 'BillModel | None' = None  # Store last fetched bill for potential convenience patterns

get

get(*, client: 'AuthenticatedClient | None' = None, congress: int, bill_type: str, bill_number: int, format_: str | None = None) -> 'BillModel'

Retrieve a single bill's details from the API.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance. If None, will use self.client if available.

None
congress int

Congress number (e.g., 118 for 118th Congress).

required
bill_type str

Bill type (e.g., 'hr', 's', 'hjres', 'sjres').

required
bill_number int

Bill number.

required
format_ str | None

Response format (default: json).

None

Returns:

Name Type Description
Bill 'BillModel'

Parsed Bill model instance from API response with client attached.

Raises:

Type Description
ValidationError

If parameters are invalid (includes suggestions)

APIError

If API request fails

ClientNotFoundError

If no client is available

Example

bill_service = Bill(client=my_client) bill = bill_service.get(congress=118, bill_type="hr", bill_number=1)

Now use extension methods

expanded_bill = bill.expand() actions = bill.get_actions()

Source code in src/congressgov/services/bill.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
def get(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int,
    bill_type: str,
    bill_number: int,
    format_: str | None = None
) -> 'BillModel':
    """
    Retrieve a single bill's details from the API.

    Args:
        client: The API client instance. If None, will use self.client if available.
        congress: Congress number (e.g., 118 for 118th Congress).
        bill_type: Bill type (e.g., 'hr', 's', 'hjres', 'sjres').
        bill_number: Bill number.
        format_: Response format (default: json).

    Returns:
        Bill: Parsed Bill model instance from API response with client attached.

    Raises:
        ValidationError: If parameters are invalid (includes suggestions)
        APIError: If API request fails
        ClientNotFoundError: If no client is available

    Example:
        >>> bill_service = Bill(client=my_client)
        >>> bill = bill_service.get(congress=118, bill_type="hr", bill_number=1)
        >>> # Now use extension methods
        >>> expanded_bill = bill.expand()
        >>> actions = bill.get_actions()
    """
    # CUSTOM: validation
    validate_congress(congress)
    validate_bill_type(bill_type)

    # --- <RESOLVE CLIENT PARAMETER> ---
    resolved_client = ApiService._resolve_client(self, client)

    # --- <CALL API> ---
    resp = bill_details_sync(
        client=resolved_client,
        congress=congress,
        bill_type=bill_type,
        bill_number=bill_number,
        format_=resolve_response_format(format_, GetBillCongressBillTypeBillNumberFormat),
    )

    # --- <PARSE RESPONSE> ---
    api_env = ApiEnvelope.model_validate(json.loads(resp.content))
    result = BillModel.model_validate(api_env.data)

    # --- <ATTACH CLIENT TO RESULT> ---
    # NOTE: This allows extension methods to access the client without explicitly passing it
    result.client = resolved_client

    # --- <STORE RESULT> ---
    self._last_result = result

    return result

search

search(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, bill_type: str | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None, from_date_time: str | None = None, to_date_time: str | None = None, sort: str | None = None) -> 'BillsModel'

Search for bills using the universal search system.

This method provides flexible searching across bills with optional filters. It delegates to the universal search system for maintainability.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance. If None, will use self.client if available.

None
congress int | None

Congress number to filter by (e.g., 118 for 118th Congress).

None
bill_type str | None

Bill type to filter by. Valid values: - 'hr': House Bill - 's': Senate Bill - 'hjres': House Joint Resolution - 'sjres': Senate Joint Resolution - 'hconres': House Concurrent Resolution - 'sconres': Senate Concurrent Resolution - 'hres': House Simple Resolution - 'sres': Senate Simple Resolution

None
format_ str | None

Response format (default: json).

None
offset int | None

Number of records to skip for pagination.

None
limit int | None

Maximum number of records to return (default: 20).

None
from_date_time str | None

Return bills updated after this datetime (ISO format).

None
to_date_time str | None

Return bills updated before this datetime (ISO format).

None
sort str | None

Sort order for results.

None

Returns:

Name Type Description
Bills 'BillsModel'

Collection of bills matching the search criteria with attached client

'BillsModel'

for extension methods.

Raises:

Type Description
ValidationError

If parameters are invalid (includes suggestions)

APIError

If API request fails

ClientNotFoundError

If no client is available

Example

from congressgov import Bill from congressgov._client import AuthenticatedClient

client = AuthenticatedClient(token="your-api-key") bill_service = Bill(client=client)

Search for House bills from 118th Congress

bills = bill_service.search(congress=118, bill_type="hr", limit=50) print(f"Found {len(bills)} House bills")

Use collection extension methods

enacted_bills = bills.enacted() by_type = bills.group_by("type")

Search with date filters

recent_bills = bill_service.search( ... from_date_time="2023-01-01T00:00:00Z", ... to_date_time="2023-12-31T23:59:59Z", ... limit=100 ... )

Source code in src/congressgov/services/bill.py
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
def search(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int | None = None,
    bill_type: str | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
    from_date_time: str | None = None,
    to_date_time: str | None = None,
    sort: str | None = None
) -> 'BillsModel':
    """
    Search for bills using the universal search system.

    This method provides flexible searching across bills with optional filters.
    It delegates to the universal search system for maintainability.

    Args:
        client: The API client instance. If None, will use self.client if available.
        congress: Congress number to filter by (e.g., 118 for 118th Congress).
        bill_type: Bill type to filter by. Valid values:
            - 'hr': House Bill
            - 's': Senate Bill
            - 'hjres': House Joint Resolution
            - 'sjres': Senate Joint Resolution
            - 'hconres': House Concurrent Resolution
            - 'sconres': Senate Concurrent Resolution
            - 'hres': House Simple Resolution
            - 'sres': Senate Simple Resolution
        format_: Response format (default: json).
        offset: Number of records to skip for pagination.
        limit: Maximum number of records to return (default: 20).
        from_date_time: Return bills updated after this datetime (ISO format).
        to_date_time: Return bills updated before this datetime (ISO format).
        sort: Sort order for results.

    Returns:
        Bills: Collection of bills matching the search criteria with attached client
        for extension methods.

    Raises:
        ValidationError: If parameters are invalid (includes suggestions)
        APIError: If API request fails
        ClientNotFoundError: If no client is available

    Example:
        >>> from congressgov import Bill
        >>> from congressgov._client import AuthenticatedClient
        >>> 
        >>> client = AuthenticatedClient(token="your-api-key")
        >>> bill_service = Bill(client=client)
        >>> 
        >>> # Search for House bills from 118th Congress
        >>> bills = bill_service.search(congress=118, bill_type="hr", limit=50)
        >>> print(f"Found {len(bills)} House bills")
        >>> 
        >>> # Use collection extension methods
        >>> enacted_bills = bills.enacted()
        >>> by_type = bills.group_by("type")
        >>> 
        >>> # Search with date filters
        >>> recent_bills = bill_service.search(
        ...     from_date_time="2023-01-01T00:00:00Z",
        ...     to_date_time="2023-12-31T23:59:59Z",
        ...     limit=100
        ... )
    """
    # CUSTOM: universal search delegation
    from congressgov.services.core.search import search as universal_search

    return universal_search(
        'bill',
        self,
        client=client,
        congress=congress,
        bill_type=bill_type,
        format_=format_,
        offset=offset,
        limit=limit,
        from_date_time=from_date_time,
        to_date_time=to_date_time,
        sort=sort
    )

search_by_laws

search_by_laws(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, law_type: str | None = None, law_number: int | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None) -> 'BillModel | BillsModel'

Search for laws using the appropriate API endpoint.

This function chooses the correct endpoint based on which arguments are provided: - If congress, law_type, and law_number: fetch a specific law (returns Bill). - If congress and law_type: fetch all laws for that congress and type (returns Bills). - If only congress: fetch all laws for that congress (returns Bills). - If none: raises ValueError.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance. If None, will use self.client if available.

None
congress int | None

Congress number to filter by (optional).

None
law_type str | None

Law type to filter by (e.g., 'pub', 'pri') (optional).

None
law_number int | None

Law number to filter by (optional).

None
format_ str | None

Response format (default: json).

None
offset int | None

Offset for pagination.

None
limit int | None

Limit for pagination.

None

Returns:

Type Description
'BillModel | BillsModel'

Bills or Bill: Parsed model from API response. - If searching for a specific law (all three arguments), returns a Bill. - Otherwise, returns Bills (list of bills/laws).

Example

bill_service = Bill(client=my_client)

Get all public laws from 118th Congress

laws = bill_service.search_by_laws(congress=118, law_type="pub")

Get a specific law

law = bill_service.search_by_laws(congress=118, law_type="pub", law_number=1)

Source code in src/congressgov/services/bill.py
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
def search_by_laws(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int | None = None,
    law_type: str | None = None,
    law_number: int | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
) -> 'BillModel | BillsModel':
    """
    Search for laws using the appropriate API endpoint.

    This function chooses the correct endpoint based on which arguments are provided:
    - If congress, law_type, and law_number: fetch a specific law (returns Bill).
    - If congress and law_type: fetch all laws for that congress and type (returns Bills).
    - If only congress: fetch all laws for that congress (returns Bills).
    - If none: raises ValueError.

    Args:
        client: The API client instance. If None, will use self.client if available.
        congress: Congress number to filter by (optional).
        law_type: Law type to filter by (e.g., 'pub', 'pri') (optional).
        law_number: Law number to filter by (optional).
        format_: Response format (default: json).
        offset: Offset for pagination.
        limit: Limit for pagination.

    Returns:
        Bills or Bill: Parsed model from API response.
            - If searching for a specific law (all three arguments), returns a Bill.
            - Otherwise, returns Bills (list of bills/laws).

    Example:
        >>> bill_service = Bill(client=my_client)
        >>> # Get all public laws from 118th Congress
        >>> laws = bill_service.search_by_laws(congress=118, law_type="pub")
        >>> # Get a specific law
        >>> law = bill_service.search_by_laws(congress=118, law_type="pub", law_number=1)
    """
    # CUSTOM: law list endpoints
    resolved_client = ApiService._resolve_client(self, client)

    # --- <CHOOSE ENDPOINT BASED ON PROVIDED ARGUMENTS> ---
    if congress is not None:
        if law_type is not None:
            if law_number is not None:
                # --- <CASE: Specific Law> ---
                # All three provided: get a specific law (returns a single Bill)
                resp = law_list_by_congress_law_type_and_law_number_sync(
                    client=resolved_client,
                    congress=congress,
                    law_type=law_type,
                    law_number=law_number,
                    format_=format_,
                    offset=offset,
                    limit=limit,
                )
                api_env = ApiEnvelope.model_validate(json.loads(resp.content))
                result = BillModel.model_validate(api_env.data)
                result.client = resolved_client
                return result
            else:
                # --- <CASE: Laws by Congress and Type> ---
                # Congress and law_type: get all laws for that congress and type (returns Bills)
                resp = law_list_by_congress_and_law_type_sync(
                    client=resolved_client,
                    congress=congress,
                    law_type=law_type,
                    format_=format_,
                    offset=offset,
                    limit=limit,
                )
                api_env = ApiEnvelope.model_validate(json.loads(resp.content))
                result = BillsModel.model_validate(api_env.data)
                result.client = resolved_client
                propagate_client_to_items(result, "bills", resolved_client)
                return result
        else:
            # --- <CASE: Laws by Congress> ---
            # Only congress: get all laws for that congress (returns Bills)
            resp = law_list_by_congress_sync(
                client=resolved_client,
                congress=congress,
                format_=format_,
                offset=offset,
                limit=limit,
            )
            api_env = ApiEnvelope.model_validate(json.loads(resp.content))
            result = BillsModel.model_validate(api_env.data)
            result.client = resolved_client
            propagate_client_to_items(result, "bills", resolved_client)
            return result
    else:
        # --- <ERROR: No Congress Provided> ---
        # No endpoint for "all laws" without congress, so raise error
        raise ValueError("At least 'congress' must be specified to search laws.")

Amendment

congressgov.services.amendment.Amendment

Amendment(client: 'AuthenticatedClient | None' = None)

Bases: ApiService

Amendment service provides API access for fetching Congressional amendment data.

This service class handles API interactions for fetching amendments from the Congress.gov API. Instance methods on the Amendment model (registered in congressgov.services.extensions.amendments) provide additional functionality.

Separation of Concerns: - This service class: Fetches data from API (get, search) - Amendment model extensions: Operate on fetched data (expand, get_actions, etc.) - Amendments model extensions: Query and filter collections (filter, by_type, etc.)

USAGE EXAMPLES

Fetch an amendment

amendment_service = Amendment(client=my_client) amendment = amendment_service.get(congress=118, amendment_type="hamdt", amendment_number="1")

Use extension methods

expanded = amendment.expand(attributes=['actions', 'cosponsors']) actions = amendment.get_actions()

Search for amendments

amendments = amendment_service.search(congress=118, limit=10) house_amdts = amendments.house_amendments()

Initialize Amendment service.

Source code in src/congressgov/services/amendment.py
73
74
75
76
def __init__(self, client: 'AuthenticatedClient | None' = None) -> None:
    """Initialize Amendment service."""
    self.client = client
    self._last_result: 'AmendmentModel | None' = None

get

get(*, client: 'AuthenticatedClient | None' = None, congress: int, amendment_type: str, amendment_number: str, format_: str | None = None) -> 'AmendmentModel'

Retrieve a single amendment's details from the API.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance.

None
congress int

Congress number.

required
amendment_type str

Amendment type (e.g., 'hamdt', 'samdt').

required
amendment_number str

Amendment number.

required
format_ str | None

Response format.

None

Returns:

Name Type Description
Amendment 'AmendmentModel'

Parsed Amendment model with client attached.

Raises:

Type Description
ValidationError

If parameters are invalid (includes suggestions)

APIError

If API request fails

ClientNotFoundError

If no client is available

Example

amendment_service = Amendment(client=my_client) amendment = amendment_service.get(congress=118, amendment_type="hamdt", amendment_number="1") expanded = amendment.expand()

Source code in src/congressgov/services/amendment.py
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
def get(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int,
    amendment_type: str,
    amendment_number: str,
    format_: str | None = None
) -> 'AmendmentModel':
    """
    Retrieve a single amendment's details from the API.

    Args:
        client: The API client instance.
        congress: Congress number.
        amendment_type: Amendment type (e.g., 'hamdt', 'samdt').
        amendment_number: Amendment number.
        format_: Response format.

    Returns:
        Amendment: Parsed Amendment model with client attached.

    Raises:
        ValidationError: If parameters are invalid (includes suggestions)
        APIError: If API request fails
        ClientNotFoundError: If no client is available

    Example:
        >>> amendment_service = Amendment(client=my_client)
        >>> amendment = amendment_service.get(congress=118, amendment_type="hamdt", amendment_number="1")
        >>> expanded = amendment.expand()
    """
    # CUSTOM: validation
    validate_congress(congress)
    validate_amendment_type(amendment_type)

    resolved_client = ApiService._resolve_client(self, client)

    resp = amendment_details_sync(
        client=resolved_client,
        congress=congress,
        amendment_type=amendment_type,
        amendment_number=amendment_number,
        format_=format_,
    )

    api_env = ApiEnvelope.model_validate(json.loads(resp.content))
    result = AmendmentModel.model_validate(api_env.data)

    # Attach client for extension methods
    result.client = resolved_client
    self._last_result = result

    return result

search

search(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, amendment_type: str | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None, from_date_time: str | None = None, to_date_time: str | None = None, sort: str | None = None) -> 'AmendmentsModel'

Search for amendments using the universal search system.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance.

None
congress int | None

Congress number (optional).

None
amendment_type str | None

Amendment type (optional).

None
format_ str | None

Response format.

None
offset int | None

Offset for pagination.

None
limit int | None

Limit for pagination.

None
from_date_time str | None

Start date/time filter.

None
to_date_time str | None

End date/time filter.

None
sort str | None

Sort order.

None

Returns:

Name Type Description
Amendments 'AmendmentsModel'

Parsed Amendments collection model.

Example

amendment_service = Amendment(client=my_client) amendments = amendment_service.search(congress=118, limit=50) house_amdts = amendments.house_amendments()

Source code in src/congressgov/services/amendment.py
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
def search(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int | None = None,
    amendment_type: str | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
    from_date_time: str | None = None,
    to_date_time: str | None = None,
    sort: str | None = None
) -> 'AmendmentsModel':
    """
    Search for amendments using the universal search system.

    Args:
        client: The API client instance.
        congress: Congress number (optional).
        amendment_type: Amendment type (optional).
        format_: Response format.
        offset: Offset for pagination.
        limit: Limit for pagination.
        from_date_time: Start date/time filter.
        to_date_time: End date/time filter.
        sort: Sort order.

    Returns:
        Amendments: Parsed Amendments collection model.

    Example:
        >>> amendment_service = Amendment(client=my_client)
        >>> amendments = amendment_service.search(congress=118, limit=50)
        >>> house_amdts = amendments.house_amendments()
    """
    # CUSTOM: universal search delegation
    from congressgov.services.core.search import search as universal_search

    return universal_search(
        'amendment',
        self,
        client=client,
        congress=congress,
        amendment_type=amendment_type,
        format_=format_,
        offset=offset,
        limit=limit,
        from_date_time=from_date_time,
        to_date_time=to_date_time,
        sort=sort
    )

Member

congressgov.services.member.Member

Member(client: 'AuthenticatedClient | None' = None)

Bases: ApiService

Member service provides API access for fetching Congressional member data.

This service class handles API interactions for fetching member information from the Congress.gov API. Once a member is fetched, instance methods on the Member model (registered in congressgov.services.extensions.members) provide additional functionality like expanding attributes and fetching sponsored/cosponsored legislation.

Separation of Concerns: - This service class: Fetches data from API (get, search, get_current_roster) - Member model extensions: Operate on fetched data (get_sponsored_legislation, etc.) - Members model extensions: Query and filter collections (filter, by_state, etc.)

USAGE EXAMPLES

Basic usage - fetch a member

member_service = Member(client=my_client) member = member_service.get(bioguide_id="A000374")

Now use extension methods on the member instance

expanded = member.expand(attributes=["sponsoredLegislation"]) sponsored = member.get_sponsored_legislation() cosponsored = member.get_cosponsored_legislation()

Search for members

members = member_service.search(state="CA", limit=10)

Use extension methods on Members collection

democrats = members.democrats() by_state = members.group_by("state")

Get current roster

roster = member_service.get_current_roster() house_members = roster['house_members'] senate_members = roster['senate_members']

Initialize Member service.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

Optional API client instance. Can also be provided per-method.

None
Source code in src/congressgov/services/member.py
89
90
91
92
93
94
95
96
97
def __init__(self, client: 'AuthenticatedClient | None' = None) -> None:
    """
    Initialize Member service.

    Args:
        client: Optional API client instance. Can also be provided per-method.
    """
    self.client = client
    self._last_result: 'MemberModel | None' = None  # Store last fetched member

get

get(*, client: 'AuthenticatedClient | None' = None, bioguide_id: str, format_: str | None = None) -> 'MemberModel'

Get detailed information about a specific member from the API.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance. If None, will use self.client if available.

None
bioguide_id str

The member's Bioguide ID (e.g., "A000374").

required
format_ str | None

Response format (default: json).

None

Returns:

Name Type Description
Member 'MemberModel'

The member details with client attached.

Raises:

Type Description
ValidationError

If parameters are invalid (includes suggestions)

APIError

If API request fails

ClientNotFoundError

If no client is available

Example

member_service = Member(client=my_client) member = member_service.get(bioguide_id="A000374")

Now use extension methods

sponsored = member.get_sponsored_legislation()

Source code in src/congressgov/services/member.py
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
def get(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    bioguide_id: str,
    format_: str | None = None
) -> 'MemberModel':
    """
    Get detailed information about a specific member from the API.

    Args:
        client: The API client instance. If None, will use self.client if available.
        bioguide_id: The member's Bioguide ID (e.g., "A000374").
        format_: Response format (default: json).

    Returns:
        Member: The member details with client attached.

    Raises:
        ValidationError: If parameters are invalid (includes suggestions)
        APIError: If API request fails
        ClientNotFoundError: If no client is available

    Example:
        >>> member_service = Member(client=my_client)
        >>> member = member_service.get(bioguide_id="A000374")
        >>> # Now use extension methods
        >>> sponsored = member.get_sponsored_legislation()
    """
    # CUSTOM: validation
    validate_bioguide_id(bioguide_id)

    # --- <RESOLVE CLIENT> ---
    client = ApiService._resolve_client(self, client)
    resolved_format = resolve_response_format(format_, GetMemberFormat)

    # --- <MAKE API CALL> ---
    response = member_details_sync(client=client, bioguide_id=bioguide_id, format_=resolved_format)
    response_json = json.loads(response.content)

    # --- <VALIDATE AND PARSE RESPONSE> ---
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = MemberModel.model_validate(api_envelope.data)

    # --- <ATTACH CLIENT TO RESULT> ---
    # NOTE: This allows extension methods to access the client without explicitly passing it
    result.client = client

    # --- <STORE FOR POTENTIAL CONVENIENCE> ---
    self._last_result = result

    return result

search

search(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, state: str | None = None, district: int | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None, from_date_time: str | None = None, to_date_time: str | None = None, current_member: str | None = None) -> 'MembersModel'

Search for members with optional filters using the universal search system.

Parameters:

Name Type Description Default
client 'AuthenticatedClient | None'

The API client instance. If None, will use self.client if available.

None
congress int | None

The Congress number (e.g., 117, 118). Optional.

None
state str | None

The state abbreviation (e.g., "CA", "NY"). Optional.

None
district int | None

The district number. Optional.

None
format_ str | None

Response format (default: json).

None
offset int | None

Number of records to skip. Optional.

None
limit int | None

Maximum number of records to return. Optional.

None
from_date_time str | None

Return members updated after this datetime (ISO format). Optional.

None
to_date_time str | None

Return members updated before this datetime (ISO format). Optional.

None
current_member str | None

Filter for current members ("true" or "false"). Optional.

None

Returns:

Name Type Description
Members 'MembersModel'

List of members matching the search criteria.

Example

member_service = Member(client=my_client) members = member_service.search(state="CA", current_member="true")

Now use collection extension methods

democrats = members.democrats() by_party = members.group_by("partyName")

Source code in src/congressgov/services/member.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
def search(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int | None = None,
    state: str | None = None,
    district: int | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
    from_date_time: str | None = None,
    to_date_time: str | None = None,
    current_member: str | None = None
) -> 'MembersModel':
    """
    Search for members with optional filters using the universal search system.

    Args:
        client: The API client instance. If None, will use self.client if available.
        congress: The Congress number (e.g., 117, 118). Optional.
        state: The state abbreviation (e.g., "CA", "NY"). Optional.
        district: The district number. Optional.
        format_: Response format (default: json).
        offset: Number of records to skip. Optional.
        limit: Maximum number of records to return. Optional.
        from_date_time: Return members updated after this datetime (ISO format). Optional.
        to_date_time: Return members updated before this datetime (ISO format). Optional.
        current_member: Filter for current members ("true" or "false"). Optional.

    Returns:
        Members: List of members matching the search criteria.

    Example:
        >>> member_service = Member(client=my_client)
        >>> members = member_service.search(state="CA", current_member="true")
        >>> # Now use collection extension methods
        >>> democrats = members.democrats()
        >>> by_party = members.group_by("partyName")
    """
    return self._fetch_members(
        client=client,
        congress=congress,
        state=state,
        district=district,
        format_=format_,
        offset=offset,
        limit=limit,
        from_date_time=from_date_time,
        to_date_time=to_date_time,
        current_member=current_member,
    )

list_by_congress

list_by_congress(*, client: 'AuthenticatedClient | None' = None, congress: int, format_: str | None = None, offset: int | None = None, limit: int | None = None, current_member: bool | None = None, fetch_all: bool = False) -> 'MembersModel'

List members who served in a specific Congress.

When fetch_all is True, requests pages of up to 250 members until the API returns a short or empty page. offset is ignored in that mode; limit sets the per-request page size (default 250).

Source code in src/congressgov/services/member.py
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
def list_by_congress(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
    current_member: bool | None = None,
    fetch_all: bool = False,
) -> 'MembersModel':
    """List members who served in a specific Congress.

    When ``fetch_all`` is True, requests pages of up to 250 members until the
    API returns a short or empty page. ``offset`` is ignored in that mode;
    ``limit`` sets the per-request page size (default 250).
    """
    # CUSTOM: member/congress/{congress} list endpoint
    validate_congress(congress)

    resolved_client = ApiService._resolve_client(self, client)
    if not fetch_all:
        return self._list_by_congress_page(
            client=resolved_client,
            congress=congress,
            format_=format_,
            offset=offset,
            limit=limit,
            current_member=current_member,
        )

    page_size = limit if limit is not None else MAX_PAGINATION_LIMIT
    return paginate_members(
        lambda off, lim: self._list_by_congress_page(
            client=resolved_client,
            congress=congress,
            format_=format_,
            offset=off,
            limit=lim,
            current_member=current_member,
        ),
        page_size=page_size,
    )

get_current_roster

get_current_roster(*, client: Any = None) -> dict[str, MembersModel]

Get the current roster of members, separated by House and Senate.

This method fetches all current members and separates them into House and Senate based on their most recent term.

Parameters:

Name Type Description Default
client Any

The API client instance. If None, will use self.client if available.

None

Returns:

Name Type Description
dict dict[str, Members]

Dictionary with keys 'house_members' and 'senate_members', each containing a Members model with the respective members.

Example

member_service = Member(client=my_client) roster = member_service.get_current_roster() house = roster['house_members'] # Members object senate = roster['senate_members'] # Members object print(f"House: {len(house)}, Senate: {len(senate)}")

Source code in src/congressgov/services/member.py
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
def get_current_roster(
    self,
    *,
    client: Any = None
) -> dict[str, MembersModel]:
    """
    Get the current roster of members, separated by House and Senate.

    This method fetches all current members and separates them into House and Senate
    based on their most recent term.

    Args:
        client: The API client instance. If None, will use self.client if available.

    Returns:
        dict: Dictionary with keys 'house_members' and 'senate_members',
              each containing a Members model with the respective members.

    Example:
        >>> member_service = Member(client=my_client)
        >>> roster = member_service.get_current_roster()
        >>> house = roster['house_members']  # Members object
        >>> senate = roster['senate_members']  # Members object
        >>> print(f"House: {len(house)}, Senate: {len(senate)}")
    """
    # --- <RESOLVE CLIENT> ---
    client = ApiService._resolve_client(self, client)

    house_members = []
    senate_members = []

    # --- <COLLECT ALL CURRENT MEMBERS> ---
    # NOTE: Paginate to completion (like list_by_congress(fetch_all=True))
    # instead of hard-capping at a fixed number of pages.
    all_members = paginate_members(
        lambda off, lim: self._fetch_members(
            client=client,
            current_member="true",
            offset=off,
            limit=lim,
        ),
        page_size=MAX_PAGINATION_LIMIT,
    )
    member_list = all_members.members or []

    # --- <SEPARATE BY CHAMBER> ---
    for member in member_list:
        # Handle possible edge cases if terms or terms.item is missing
        if not member.terms or not getattr(member.terms, "item", None):
            continue

        # Defensive: handle if item is not a list
        terms_items = getattr(member.terms, "item", [])
        if not isinstance(terms_items, list):
            terms_items = [terms_items] if terms_items is not None else []
        if not terms_items:
            continue

        # Get latest term by startYear (fall back to -inf if not present)
        latest_term = max(terms_items, key=lambda t: getattr(t, "startYear", float('-inf')) or float('-inf'))
        chamber = getattr(latest_term, "chamber", None)

        if chamber == "House of Representatives":
            house_members.append(member)
        elif chamber == "Senate":
            senate_members.append(member)
        # If chamber is something else or None, skip

    # --- <RETURN SEPARATED ROSTERS> ---
    house = MembersModel.model_validate(dict(members=house_members))
    senate = MembersModel.model_validate(dict(members=senate_members))
    house.client = client
    senate.client = client
    propagate_client_to_items(house, "members", client)
    propagate_client_to_items(senate, "members", client)
    return dict(house_members=house, senate_members=senate)

Committee

congressgov.services.committee.Committee

Committee(client: 'AuthenticatedClient | None' = None)

Bases: ApiService

Committee service provides API access for fetching Congressional committee data.

Separation of Concerns: - This service class: Fetches data from API (get, search) - Committee model extensions: Operate on fetched data (expand, get_bills, etc.) - Committees model extensions: Query and filter collections

Source code in src/congressgov/services/committee.py
75
76
77
def __init__(self, client: 'AuthenticatedClient | None' = None) -> None:
    self.client = client
    self._last_result: 'CommitteeModel | None' = None

get

get(*, client: 'AuthenticatedClient | None' = None, chamber: str, committee_code: str, format_: str | None = None) -> 'CommitteeModel'

Get detailed information about a specific committee.

Source code in src/congressgov/services/committee.py
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
def get(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    chamber: str,
    committee_code: str,
    format_: str | None = None
) -> 'CommitteeModel':
    """Get detailed information about a specific committee."""
    # CUSTOM: validation
    validate_chamber(chamber)
    validate_committee_code(committee_code)

    client = ApiService._resolve_client(self, client)
    chamber_param = GetCommitteeChamberCommitteeCodeChamber(chamber.lower())

    response = committee_details_sync(
        client=client,
        chamber=chamber_param,
        committee_code=committee_code,
        format_=resolve_response_format(format_, GetCommitteeChamberCommitteeCodeFormat),
    )
    response_json = json.loads(response.content)

    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CommitteeModel.model_validate(api_envelope.data)

    result.client = client
    self._last_result = result

    return result

get_by_congress

get_by_congress(*, client: 'AuthenticatedClient | None' = None, congress: int, chamber: str, committee_code: str, format_: str | None = None) -> 'CommitteeModel'

Get committee detail scoped to a specific Congress.

Source code in src/congressgov/services/committee.py
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
def get_by_congress(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int,
    chamber: str,
    committee_code: str,
    format_: str | None = None,
) -> 'CommitteeModel':
    """Get committee detail scoped to a specific Congress."""
    # CUSTOM: congress-scoped committee detail
    validate_congress(congress)
    validate_chamber(chamber)
    validate_committee_code(committee_code)

    client = ApiService._resolve_client(self, client)
    chamber_param = GetCommitteeCongressChamberCommitteeCodeChamber(chamber)
    response = committee_by_congress_detailed(
        client=client,
        congress=congress,
        chamber=chamber_param,
        committee_code=committee_code,
        format_=resolve_response_format(
            format_, GetCommitteeCongressChamberCommitteeCodeFormat
        ),
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CommitteeModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, chamber: str | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None) -> 'CommitteesModel'

Search for committees using the universal search system.

Source code in src/congressgov/services/committee.py
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
def search(
    self,
    *,
    client: 'AuthenticatedClient | None' = None,
    congress: int | None = None,
    chamber: str | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None
) -> 'CommitteesModel':
    """Search for committees using the universal search system."""
    # CUSTOM: universal search delegation
    from congressgov.services.core.search import search as universal_search

    return universal_search(
        'committee',
        self,
        client=client,
        congress=congress,
        chamber=chamber,
        format_=format_,
        offset=offset,
        limit=limit
    )

CommitteeMeeting

congressgov.services.committee_meeting.CommitteeMeeting

CommitteeMeeting(client: AuthenticatedClient | None = None)

Bases: ApiService

CommitteeMeeting service provides API access for committee meeting data.

Source code in src/congressgov/services/committee_meeting.py
33
34
35
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, chamber: str, event_id: str, format_: str = None) -> CommitteeMeetingModel

Get detailed information about a specific committee meeting.

Source code in src/congressgov/services/committee_meeting.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    chamber: str,
    event_id: str,
    format_: str = None
) -> CommitteeMeetingModel:
    """Get detailed information about a specific committee meeting."""
    # CUSTOM: validation
    validate_congress(congress)
    validate_chamber(chamber)

    client = ApiService._resolve_client(self, client)
    response = committee_meeting_detail_sync(
        client=client,
        congress=congress,
        chamber=resolve_chamber(chamber, GetCommitteeMeetingCongressChamberEventIdChamber),
        event_id=event_id,
        format_=resolve_response_format(
            format_, GetCommitteeMeetingCongressChamberEventIdFormat
        ),
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    raise_for_envelope_detail_response(
        response,
        response_json,
        api_envelope,
        resource_label="Committee meeting",
        identifiers={
            "congress": congress,
            "chamber": chamber,
            "event_id": event_id,
        },
    )
    result = CommitteeMeetingModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, chamber: str = None, format_: str = None, offset: int = None, limit: int = None) -> CommitteeMeetingsModel

Search for committee meetings using the universal search system.

Source code in src/congressgov/services/committee_meeting.py
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    chamber: str = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> CommitteeMeetingsModel:
    """Search for committee meetings using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'committee-meeting',
        self,
        client=client,
        congress=congress,
        chamber=chamber,
        format_=format_,
        offset=offset,
        limit=limit
    )

CommitteePrint

congressgov.services.committee_print.CommitteePrint

CommitteePrint(client: AuthenticatedClient | None = None)

Bases: ApiService

CommitteePrint service provides API access for committee print data.

Source code in src/congressgov/services/committee_print.py
42
43
44
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, jacket_number: int, chamber: str, format_: str = None) -> CommitteePrintModel

Get detailed information about a specific committee print.

Source code in src/congressgov/services/committee_print.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    jacket_number: int,
    chamber: str,
    format_: str = None
) -> CommitteePrintModel:
    """Get detailed information about a specific committee print."""
    # CUSTOM: validation
    validate_congress(congress)
    validate_chamber(chamber)

    client = ApiService._resolve_client(self, client)
    response = committee_print_detail_sync(
        client=client,
        congress=congress,
        jacket_number=jacket_number,
        chamber=chamber,
        format_=format_
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CommitteePrintModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

get_text

get_text(*, client: AuthenticatedClient | None = None, congress: int, chamber: str, jacket_number: int, format_: str = None)

Return text versions for a committee print.

Source code in src/congressgov/services/committee_print.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
def get_text(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    chamber: str,
    jacket_number: int,
    format_: str = None,
):
    """Return text versions for a committee print."""
    # CUSTOM: committee print text sub-endpoint
    validate_congress(congress)
    validate_chamber(chamber)

    client = ApiService._resolve_client(self, client)
    response = committee_print_text_sync(
        client=client,
        congress=congress,
        chamber=chamber,
        jacket_number=jacket_number,
        format_=format_,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    payload = response_json.get("data", api_envelope.data)
    if isinstance(payload, list):
        return [CommitteePrintTextModel.model_validate(item) for item in payload]
    return CommitteePrintTextModel.model_validate(payload)

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, format_: str = None, offset: int = None, limit: int = None) -> CommitteePrintsModel

Search for committee prints using the universal search system.

Source code in src/congressgov/services/committee_print.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> CommitteePrintsModel:
    """Search for committee prints using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'committee-print',
        self,
        client=client,
        congress=congress,
        format_=format_,
        offset=offset,
        limit=limit
    )

CommitteeReport

congressgov.services.committee_report.CommitteeReport

CommitteeReport(client: AuthenticatedClient | None = None)

Bases: ApiService

CommitteeReport service provides API access for committee report data.

Source code in src/congressgov/services/committee_report.py
42
43
44
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, report_type: str, report_number: int, format_: str = None) -> CommitteeReportModel

Get detailed information about a specific committee report.

Source code in src/congressgov/services/committee_report.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    report_type: str,
    report_number: int,
    format_: str = None
) -> CommitteeReportModel:
    """Get detailed information about a specific committee report."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = committee_report_details_sync(
        client=client,
        congress=congress,
        report_type=report_type,
        report_number=report_number,
        format_=format_
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CommitteeReportModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

get_text

get_text(*, client: AuthenticatedClient | None = None, congress: int, report_type: str, report_number: int, format_: str = None)

Return text versions for a committee report.

Source code in src/congressgov/services/committee_report.py
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def get_text(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    report_type: str,
    report_number: int,
    format_: str = None,
):
    """Return text versions for a committee report."""
    # CUSTOM: committee report text sub-endpoint
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = committee_report_id_text_sync(
        client=client,
        congress=congress,
        report_type=report_type,
        report_number=report_number,
        format_=format_,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    payload = response_json.get("data", api_envelope.data)
    if isinstance(payload, list):
        return [CommitteeReportTextModel.model_validate(item) for item in payload]
    return CommitteeReportTextModel.model_validate(payload)

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, report_type: str = None, format_: str = None, offset: int = None, limit: int = None) -> CommitteeReportsModel

Search for committee reports using the universal search system.

Source code in src/congressgov/services/committee_report.py
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    report_type: str = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> CommitteeReportsModel:
    """Search for committee reports using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'committee-report',
        self,
        client=client,
        congress=congress,
        report_type=report_type,
        format_=format_,
        offset=offset,
        limit=limit
    )

Congress

congressgov.services.congress.Congress

Congress(client: AuthenticatedClient | None = None)

Bases: ApiService

Congress service provides API access for Congressional session data.

Source code in src/congressgov/services/congress.py
41
42
43
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

current

current(*, client: AuthenticatedClient | None = None, format_: str = None) -> CongressModel

Get the current Congress session information.

Source code in src/congressgov/services/congress.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def current(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None
) -> CongressModel:
    """Get the current Congress session information."""
    # CUSTOM: current session method
    client = ApiService._resolve_client(self, client)
    response = congress_current_list_sync(
        client=client,
        format_=resolve_response_format(format_, GetCongressCurrentFormat),
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CongressModel.model_validate(api_envelope.data)
    result.client = client
    return result

get

get(*, client: AuthenticatedClient | None = None, congress: int, format_: str = None) -> CongressModel

Get detailed information about a specific Congress session.

Source code in src/congressgov/services/congress.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    format_: str = None
) -> CongressModel:
    """Get detailed information about a specific Congress session."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = congress_details_sync(
        client=client,
        congress=congress,
        format_=resolve_response_format(format_, GetCongressCongressFormat),
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CongressModel.model_validate(api_envelope.data)
    _ensure_congress_number(result, congress)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, format_: str = None, offset: int = None, limit: int = None) -> CongressesModel

List all Congress sessions.

Source code in src/congressgov/services/congress.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> CongressesModel:
    """List all Congress sessions."""
    # CUSTOM: direct list search
    client = ApiService._resolve_client(self, client)
    response = congress_list_sync(
        client=client,
        format_=resolve_response_format(format_, GetCongressFormat),
        offset=offset,
        limit=limit,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CongressesModel.model_validate(api_envelope.data)
    result.client = client
    propagate_client_to_items(result, "congresses", client)
    return result

CongressionalRecord

congressgov.services.congressional_record.CongressionalRecord

CongressionalRecord(client: AuthenticatedClient | None = None)

Bases: ApiService

CongressionalRecord service provides API access for congressional record data.

Source code in src/congressgov/services/congressional_record.py
16
17
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client

search

search(*, client: AuthenticatedClient | None = None, year: int = None, month: int = None, day: int = None, format_: str = None, offset: int = None, limit: int = None)

Search for congressional records using the universal search system.

Source code in src/congressgov/services/congressional_record.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    year: int = None,
    month: int = None,
    day: int = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
):
    """Search for congressional records using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'congressional-record',
        self,
        client=client,
        year=year,
        month=month,
        day=day,
        format_=format_,
        offset=offset,
        limit=limit
    )

DailyCongressionalRecord

congressgov.services.daily_congressional_record.DailyCongressionalRecord

DailyCongressionalRecord(client: AuthenticatedClient | None = None)

Bases: ApiService

Daily Congressional Record API (volume / issue / articles), distinct from bound record search.

Source code in src/congressgov/services/daily_congressional_record.py
47
48
49
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

search

search(*, client: AuthenticatedClient | None = None, format_: str = None, offset: int = None, limit: int = None) -> DailyCongressionalRecordModel

List daily Congressional Record issues (most recent first).

Source code in src/congressgov/services/daily_congressional_record.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> DailyCongressionalRecordModel:
    """List daily Congressional Record issues (most recent first)."""
    # CUSTOM: direct list via ApiEnvelope
    client = ApiService._resolve_client(self, client)
    response = daily_congressional_record_list_detailed(
        client=client,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    result = _parse_api_payload(response, DailyCongressionalRecordModel)
    result.client = client
    self._last_result = result
    return result

get_volume

get_volume(*, client: AuthenticatedClient | None = None, volume_number: int, format_: str = None, offset: int = None, limit: int = None) -> DailyCongressionalRecordModel

List daily Congressional Record issues for a volume.

Source code in src/congressgov/services/daily_congressional_record.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
def get_volume(
    self,
    *,
    client: AuthenticatedClient | None = None,
    volume_number: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> DailyCongressionalRecordModel:
    """List daily Congressional Record issues for a volume."""
    # CUSTOM: volume sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = daily_congressional_record_volume_detailed(
        client=client,
        volume_number=volume_number,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    result = _parse_api_payload(response, DailyCongressionalRecordModel)
    result.client = client
    self._last_result = result
    return result

get_issue

get_issue(*, client: AuthenticatedClient | None = None, volume_number: int, issue_number: int, format_: str = None, offset: int = None, limit: int = None) -> DailyCongressionalRecordIssueModel

Get a daily Congressional Record issue by volume and issue number.

Source code in src/congressgov/services/daily_congressional_record.py
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
def get_issue(
    self,
    *,
    client: AuthenticatedClient | None = None,
    volume_number: int,
    issue_number: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> DailyCongressionalRecordIssueModel:
    """Get a daily Congressional Record issue by volume and issue number."""
    # CUSTOM: issue sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = daily_congressional_record_issue_detailed(
        client=client,
        volume_number=volume_number,
        issue_number=issue_number,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    result = _parse_api_payload(response, DailyCongressionalRecordIssueModel)
    result.client = client
    self._last_result = result
    return result

get_articles

get_articles(*, client: AuthenticatedClient | None = None, volume_number: int, issue_number: int, format_: str = None, offset: int = None, limit: int = None) -> DailyCongressionalRecordArticlesModel

List articles for a daily Congressional Record issue.

Source code in src/congressgov/services/daily_congressional_record.py
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
def get_articles(
    self,
    *,
    client: AuthenticatedClient | None = None,
    volume_number: int,
    issue_number: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> DailyCongressionalRecordArticlesModel:
    """List articles for a daily Congressional Record issue."""
    # CUSTOM: articles sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = daily_congressional_record_articles_detailed(
        client=client,
        volume_number=volume_number,
        issue_number=issue_number,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    result = _parse_api_payload(response, DailyCongressionalRecordArticlesModel)
    result.client = client
    return result

BoundCongressionalRecord

congressgov.services.bound_congressional_record.BoundCongressionalRecord

BoundCongressionalRecord(client: AuthenticatedClient | None = None)

Bases: ApiService

BoundCongressionalRecord service provides API access for bound congressional record data.

Source code in src/congressgov/services/bound_congressional_record.py
23
24
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client

search

search(*, client: AuthenticatedClient | None = None, year: int = None, month: int = None, format_: str = None, offset: int = None, limit: int = None)

Search for bound congressional records using the universal search system.

Source code in src/congressgov/services/bound_congressional_record.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    year: int = None,
    month: int = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
):
    """Search for bound congressional records using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'bound-congressional-record',
        self,
        client=client,
        year=year,
        month=month,
        format_=format_,
        offset=offset,
        limit=limit
    )

get_by_year

get_by_year(*, client: AuthenticatedClient | None = None, year: int, format_: str = None, offset: int = None, limit: int = None)

List bound congressional records for a year.

Source code in src/congressgov/services/bound_congressional_record.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def get_by_year(
    self,
    *,
    client: AuthenticatedClient | None = None,
    year: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
):
    """List bound congressional records for a year."""
    # CUSTOM: year sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = bound_congressional_record_list_by_year_sync(
        client=client, year=year, format_=format_, offset=offset, limit=limit
    )
    return ApiEnvelope.model_validate(json.loads(response.content)).data

get_by_year_month

get_by_year_month(*, client: AuthenticatedClient | None = None, year: int, month: int, format_: str = None, offset: int = None, limit: int = None)

List bound congressional records for a year and month.

Source code in src/congressgov/services/bound_congressional_record.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def get_by_year_month(
    self,
    *,
    client: AuthenticatedClient | None = None,
    year: int,
    month: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
):
    """List bound congressional records for a year and month."""
    # CUSTOM: year/month sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = bound_congressional_record_list_by_year_and_month_sync(
        client=client,
        year=year,
        month=month,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    return ApiEnvelope.model_validate(json.loads(response.content)).data

get_by_date

get_by_date(*, client: AuthenticatedClient | None = None, year: int, month: int, day: int, format_: str = None, offset: int = None, limit: int = None)

List bound congressional records for a specific date.

Source code in src/congressgov/services/bound_congressional_record.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
def get_by_date(
    self,
    *,
    client: AuthenticatedClient | None = None,
    year: int,
    month: int,
    day: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
):
    """List bound congressional records for a specific date."""
    # CUSTOM: year/month/day sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = bound_congressional_record_list_by_year_and_month_and_day_sync(
        client=client,
        year=year,
        month=month,
        day=day,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    return ApiEnvelope.model_validate(json.loads(response.content)).data

CRSReport

congressgov.services.crsreport.CRSReport

CRSReport(client: AuthenticatedClient | None = None)

Bases: ApiService

CRSReport service provides API access for CRS report data.

Source code in src/congressgov/services/crsreport.py
23
24
25
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, report_number: str, format_: str = None) -> CRSReportModel

Get detailed information about a specific CRS report.

Source code in src/congressgov/services/crsreport.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    report_number: str,
    format_: str = None
) -> CRSReportModel:
    """Get detailed information about a specific CRS report."""
    client = ApiService._resolve_client(self, client)
    response = crsreport_details_sync(
        client=client,
        report_number=report_number,
        format_=format_,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = CRSReportModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, format_: str = None, offset: int = None, limit: int = None)

Search for CRS reports using the universal search system.

Source code in src/congressgov/services/crsreport.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
):
    """Search for CRS reports using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'crs-report',
        self,
        client=client,
        format_=format_,
        offset=offset,
        limit=limit
    )

Hearing

congressgov.services.hearing.Hearing

Hearing(client: AuthenticatedClient | None = None)

Bases: ApiService

Hearing service provides API access for Congressional hearing data.

Source code in src/congressgov/services/hearing.py
26
27
28
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, chamber: str, jacket_number: int, format_: str = None) -> HearingModel

Get detailed information about a specific hearing.

Source code in src/congressgov/services/hearing.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    chamber: str,
    jacket_number: int,
    format_: str = None
) -> HearingModel:
    """Get detailed information about a specific hearing."""
    # CUSTOM: validation
    validate_congress(congress)
    validate_chamber(chamber)

    client = ApiService._resolve_client(self, client)

    response = hearing_detail_sync(
        client=client,
        congress=congress,
        chamber=chamber,
        jacket_number=jacket_number,
        format_=format_,
    )
    response_json = json.loads(response.content)

    api_envelope = ApiEnvelope.model_validate(response_json)
    result = HearingModel.model_validate(api_envelope.data)

    result.client = client
    self._last_result = result

    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, chamber: str = None, format_: str = None, offset: int = None, limit: int = None) -> HearingsModel

Search for hearings using the universal search system.

Source code in src/congressgov/services/hearing.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    chamber: str = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> HearingsModel:
    """Search for hearings using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'hearing',
        self,
        client=client,
        congress=congress,
        chamber=chamber,
        format_=format_,
        offset=offset,
        limit=limit
    )

HouseCommunication

congressgov.services.house_communication.HouseCommunication

HouseCommunication(client: AuthenticatedClient | None = None)

Bases: ApiService

HouseCommunication service provides API access for House communication data.

Source code in src/congressgov/services/house_communication.py
25
26
27
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, communication_type: str, communication_number: int, format_: str = None) -> HouseCommunicationModel

Get detailed information about a specific House communication.

Source code in src/congressgov/services/house_communication.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    communication_type: str,
    communication_number: int,
    format_: str = None
) -> HouseCommunicationModel:
    """Get detailed information about a specific House communication."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = house_communication_detail_sync(
        client=client,
        congress=congress,
        communication_type=communication_type,
        communication_number=communication_number,
        format_=format_
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = HouseCommunicationModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, communication_type: str = None, format_: str = None, offset: int = None, limit: int = None) -> HouseCommunicationsModel

Search for House communications using the universal search system.

Source code in src/congressgov/services/house_communication.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    communication_type: str = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> HouseCommunicationsModel:
    """Search for House communications using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'house-communication',
        self,
        client=client,
        congress=congress,
        communication_type=communication_type,
        format_=format_,
        offset=offset,
        limit=limit
    )

HouseRequirement

congressgov.services.house_requirement.HouseRequirement

HouseRequirement(client: AuthenticatedClient | None = None)

Bases: ApiService

HouseRequirement service provides API access for House requirement data.

Source code in src/congressgov/services/house_requirement.py
29
30
31
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, requirement_number: int, format_: str = None) -> HouseRequirementModel

Get detailed information about a specific House requirement.

Source code in src/congressgov/services/house_requirement.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    requirement_number: int,
    format_: str = None
) -> HouseRequirementModel:
    """Get detailed information about a specific House requirement."""
    client = ApiService._resolve_client(self, client)
    response = house_requirement_detail_sync(
        client=client,
        requirement_number=requirement_number,
        format_=format_
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = HouseRequirementModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, format_: str = None, offset: int = None, limit: int = None) -> HouseRequirementsModel

Search for House requirements using the universal search system.

Source code in src/congressgov/services/house_requirement.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> HouseRequirementsModel:
    """Search for House requirements using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'house-requirement',
        self,
        client=client,
        format_=format_,
        offset=offset,
        limit=limit
    )

matching_communications

matching_communications(*, client: AuthenticatedClient | None = None, requirement_number: int, format_: str = None, offset: int = None, limit: int = None)

List communications matching a House requirement.

Source code in src/congressgov/services/house_requirement.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
def matching_communications(
    self,
    *,
    client: AuthenticatedClient | None = None,
    requirement_number: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
):
    """List communications matching a House requirement."""
    # CUSTOM: matching communications sub-endpoint
    client = ApiService._resolve_client(self, client)
    response = house_requirement_matching_communications_detailed(
        client=client,
        requirement_number=requirement_number,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    return api_envelope.data

HouseVote

congressgov.services.house_vote.HouseVote

HouseVote(client: AuthenticatedClient | None = None)

Bases: ApiService

HouseVote service provides API access for House vote data.

Source code in src/congressgov/services/house_vote.py
38
39
40
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, session: int, vote_number: int, format_: str = None) -> HouseVoteModel

Get detailed information about a specific House vote.

Source code in src/congressgov/services/house_vote.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    session: int,
    vote_number: int,
    format_: str = None
) -> HouseVoteModel:
    """Get detailed information about a specific House vote."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = house_vote_details_sync(
        client=client,
        congress=congress,
        session=session,
        vote_number=vote_number,
        format_=format_,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = HouseVoteModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, format_: str = None, offset: int = None, limit: int = None) -> HouseVotesModel

Search for House votes using the universal search system.

Source code in src/congressgov/services/house_vote.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> HouseVotesModel:
    """Search for House votes using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'house-vote',
        self,
        client=client,
        congress=congress,
        format_=format_,
        offset=offset,
        limit=limit
    )

list_by_congress_session

list_by_congress_session(*, client: AuthenticatedClient | None = None, congress: int, session: int, format_: str = None, offset: int = None, limit: int = None) -> HouseVotesModel

List House votes for a Congress and session.

Source code in src/congressgov/services/house_vote.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
def list_by_congress_session(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    session: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> HouseVotesModel:
    """List House votes for a Congress and session."""
    # CUSTOM: congress/session vote list
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    session_param = GetHouseVoteCongressSessionSession(session)
    response = house_vote_list_congress_session_sync(
        client=client,
        congress=congress,
        session=session_param,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = HouseVotesModel.model_validate(api_envelope.data)
    result.client = client
    return result

members

members(*, client: AuthenticatedClient | None = None, congress: int, session: int, vote_number: int, format_: str = None, offset: int = None, limit: int = None) -> MemberVotesModel

Return per-member vote positions for a House roll call vote (beta endpoint).

Source code in src/congressgov/services/house_vote.py
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
def members(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    session: int,
    vote_number: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> MemberVotesModel:
    """Return per-member vote positions for a House roll call vote (beta endpoint)."""
    # CUSTOM: members sub-endpoint
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    session_param = GetHouseVoteCongressSessionVoteNumberMembersSession(session)
    response = house_vote_members_detailed(
        client=client,
        congress=congress,
        session=session_param,
        vote_number=vote_number,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    payload = api_envelope.data if api_envelope.data is not None else response_json
    result = MemberVotesModel.model_validate(payload)
    result.client = client
    return result

Nomination

congressgov.services.nomination.Nomination

Nomination(client: AuthenticatedClient | None = None)

Bases: ApiService

Nomination service provides API access for Congressional nomination data.

Source code in src/congressgov/services/nomination.py
44
45
46
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, nomination_number: int, format_: str = None) -> NominationModel

Get detailed information about a specific nomination.

Source code in src/congressgov/services/nomination.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    nomination_number: int,
    format_: str = None
) -> NominationModel:
    """Get detailed information about a specific nomination."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)

    response = nomination_detail_sync(
        client=client, 
        congress=congress, 
        nomination_number=nomination_number,
        format_=format_
    )
    response_json = json.loads(response.content)

    api_envelope = ApiEnvelope.model_validate(response_json)
    result = NominationModel.model_validate(api_envelope.data)

    result.client = client
    self._last_result = result

    return result

get_nominees

get_nominees(*, client: AuthenticatedClient | None = None, congress: int, nomination_number: int, ordinal: int, format_: str = None, offset: int = None, limit: int = None) -> NomineesModel

Get nominees for a nomination at a specific ordinal.

Source code in src/congressgov/services/nomination.py
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
def get_nominees(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    nomination_number: int,
    ordinal: int,
    format_: str = None,
    offset: int = None,
    limit: int = None,
) -> NomineesModel:
    """Get nominees for a nomination at a specific ordinal."""
    # CUSTOM: nomination ordinal sub-endpoint
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = nominees_sync(
        client=client,
        congress=congress,
        nomination_number=nomination_number,
        ordinal=ordinal,
        format_=format_,
        offset=offset,
        limit=limit,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    payload = api_envelope.data if api_envelope.data is not None else response_json
    result = NomineesModel.model_validate(payload)
    result.client = client
    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, format_: str = None, offset: int = None, limit: int = None) -> NominationsModel

Search for nominations using the universal search system.

Source code in src/congressgov/services/nomination.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> NominationsModel:
    """Search for nominations using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'nomination',
        self,
        client=client,
        congress=congress,
        format_=format_,
        offset=offset,
        limit=limit
    )

SenateCommunication

congressgov.services.senate_communication.SenateCommunication

SenateCommunication(client: AuthenticatedClient | None = None)

Bases: ApiService

SenateCommunication service provides API access for Senate communication data.

Source code in src/congressgov/services/senate_communication.py
25
26
27
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client
    self._last_result = None

get

get(*, client: AuthenticatedClient | None = None, congress: int, communication_type: str, communication_number: int, format_: str = None) -> SenateCommunicationModel

Get detailed information about a specific Senate communication.

Source code in src/congressgov/services/senate_communication.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def get(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int,
    communication_type: str,
    communication_number: int,
    format_: str = None
) -> SenateCommunicationModel:
    """Get detailed information about a specific Senate communication."""
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = senate_communication_detail_sync(
        client=client,
        congress=congress,
        communication_type=communication_type,
        communication_number=communication_number,
        format_=format_
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = SenateCommunicationModel.model_validate(api_envelope.data)
    result.client = client
    self._last_result = result
    return result

search

search(*, client: AuthenticatedClient | None = None, congress: int = None, communication_type: str = None, format_: str = None, offset: int = None, limit: int = None) -> SenateCommunicationsModel

Search for Senate communications using the universal search system.

Source code in src/congressgov/services/senate_communication.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    congress: int = None,
    communication_type: str = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> SenateCommunicationsModel:
    """Search for Senate communications using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'senate-communication',
        self,
        client=client,
        congress=congress,
        communication_type=communication_type,
        format_=format_,
        offset=offset,
        limit=limit
    )

Summaries

congressgov.services.summaries.Summaries

Summaries(client: AuthenticatedClient | None = None)

Bases: ApiService

Summaries service provides API access for bill summaries data.

Source code in src/congressgov/services/summaries.py
20
21
def __init__(self, client: AuthenticatedClient | None = None):
    self.client = client

search

search(*, client: AuthenticatedClient | None = None, format_: str = None, offset: int = None, limit: int = None) -> SummariesModel

Search for bill summaries using the universal search system.

Source code in src/congressgov/services/summaries.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def search(
    self,
    *,
    client: AuthenticatedClient | None = None,
    format_: str = None,
    offset: int = None,
    limit: int = None
) -> SummariesModel:
    """Search for bill summaries using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'summary',
        self,
        client=client,
        format_=format_,
        offset=offset,
        limit=limit
    )

Treaty

congressgov.services.treaty.Treaty

Treaty(client: 'AuthenticatedClient | None' = None)

Bases: ApiService

Treaty service provides API access for treaty data.

Source code in src/congressgov/services/treaty.py
42
43
44
def __init__(self, client: "AuthenticatedClient | None" = None) -> None:
    self.client = client
    self._last_result: TreatyModel | None = None

get

get(*, client: 'AuthenticatedClient | None' = None, congress: int, treaty_number: int, treaty_suffix: str | None = None, format_: str | None = None) -> TreatyModel

Get detailed information about a specific treaty.

Raises:

Type Description
ClientNotFoundError

If no API client is available.

Source code in src/congressgov/services/treaty.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def get(
    self,
    *,
    client: "AuthenticatedClient | None" = None,
    congress: int,
    treaty_number: int,
    treaty_suffix: str | None = None,
    format_: str | None = None,
) -> TreatyModel:
    """Get detailed information about a specific treaty.

    Raises:
        ClientNotFoundError: If no API client is available.
    """
    # CUSTOM: validation
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)

    if treaty_suffix:
        response = treaty_details_sync(
            client=client,
            congress=congress,
            treaty_number=treaty_number,
            treaty_suffix=treaty_suffix,
            format_=format_,
        )
    else:
        response = treaty_detail_sync(
            client=client,
            congress=congress,
            treaty_number=treaty_number,
            format_=format_,
        )
    response_json = json.loads(response.content)

    api_envelope = ApiEnvelope.model_validate(response_json)
    result = TreatyModel.model_validate(api_envelope.data)

    result.client = client
    self._last_result = result

    return result

search

search(*, client: 'AuthenticatedClient | None' = None, congress: int | None = None, format_: str | None = None, offset: int | None = None, limit: int | None = None) -> TreatiesModel

Search for treaties using the universal search system.

Source code in src/congressgov/services/treaty.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def search(
    self,
    *,
    client: "AuthenticatedClient | None" = None,
    congress: int | None = None,
    format_: str | None = None,
    offset: int | None = None,
    limit: int | None = None,
) -> TreatiesModel:
    """Search for treaties using the universal search system."""
    from congressgov.services.core.search import search as universal_search

    # CUSTOM: universal search delegation
    return universal_search(
        'treaty',
        self,
        client=client,
        congress=congress,
        format_=format_,
        offset=offset,
        limit=limit
    )

get_actions

get_actions(*, client: 'AuthenticatedClient | None' = None, congress: int, treaty_number: int, format_: str | None = None) -> ActionsModel

Return actions for a treaty.

Source code in src/congressgov/services/treaty.py
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
def get_actions(
    self,
    *,
    client: "AuthenticatedClient | None" = None,
    congress: int,
    treaty_number: int,
    format_: str | None = None,
) -> ActionsModel:
    """Return actions for a treaty."""
    # CUSTOM: treaty actions sub-endpoint
    validate_congress(congress)

    client = ApiService._resolve_client(self, client)
    response = treaty_actions_sync(
        client=client,
        congress=congress,
        treaty_number=treaty_number,
        format_=format_,
    )
    response_json = json.loads(response.content)
    api_envelope = ApiEnvelope.model_validate(response_json)
    result = ActionsModel.model_validate(api_envelope.data)
    result.client = client
    return result