Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.11.0"
".": "1.12.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-2526a31a361274411e6cfc64858b1b084a22ffb491a9490374b717534827b3e1.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-cf610d4dbb7e3d84161b5783a0861b2e551422eb5cf727dde86a839325d7ef76.yml
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## 1.12.0 (2024-12-17)

Full Changelog: [v1.11.0...v1.12.0](https://github.com/Finch-API/finch-api-python/compare/v1.11.0...v1.12.0)

### Features

* **api:** api update ([#539](https://github.com/Finch-API/finch-api-python/issues/539)) ([8808bc2](https://github.com/Finch-API/finch-api-python/commit/8808bc28d454383cc3375261c5fd68040ba1f63e))
* **api:** api update ([#542](https://github.com/Finch-API/finch-api-python/issues/542)) ([bf7e2d0](https://github.com/Finch-API/finch-api-python/commit/bf7e2d04a43f70b3dd034ea5d9aae240f21aa271))
* **api:** api update ([#545](https://github.com/Finch-API/finch-api-python/issues/545)) ([838c2e1](https://github.com/Finch-API/finch-api-python/commit/838c2e12252ee85f1e01c54b18563190f2afa331))
* **api:** api update ([#546](https://github.com/Finch-API/finch-api-python/issues/546)) ([3fc385f](https://github.com/Finch-API/finch-api-python/commit/3fc385f739eb1d566d3b93a738795f9a0cc76ddf))
* **api:** api update ([#551](https://github.com/Finch-API/finch-api-python/issues/551)) ([de22285](https://github.com/Finch-API/finch-api-python/commit/de222853bcf92960f3fc27668d66f2df06d13c23))


### Chores

* **internal:** add support for TypeAliasType ([#544](https://github.com/Finch-API/finch-api-python/issues/544)) ([0b2d28e](https://github.com/Finch-API/finch-api-python/commit/0b2d28e6721227e13ff9f5a9f99cec896532d6cd))
* **internal:** bump pydantic dependency ([#540](https://github.com/Finch-API/finch-api-python/issues/540)) ([a6bbbbf](https://github.com/Finch-API/finch-api-python/commit/a6bbbbfd913a3900b0d69dcbc0df6869c4e30f1d))
* **internal:** bump pyright ([#537](https://github.com/Finch-API/finch-api-python/issues/537)) ([1233851](https://github.com/Finch-API/finch-api-python/commit/123385153a2babb6771c64bc3712f5f50a31c4cd))
* **internal:** bump pyright ([#543](https://github.com/Finch-API/finch-api-python/issues/543)) ([3310b4b](https://github.com/Finch-API/finch-api-python/commit/3310b4bcf1a29c2a966b0c32b8acc91f6955db4e))
* **internal:** codegen related update ([#535](https://github.com/Finch-API/finch-api-python/issues/535)) ([9bd789d](https://github.com/Finch-API/finch-api-python/commit/9bd789d78363cb269be7e6b213de5d5ba40448cd))
* **internal:** fix some typos ([#552](https://github.com/Finch-API/finch-api-python/issues/552)) ([0f1f7c8](https://github.com/Finch-API/finch-api-python/commit/0f1f7c8bb990280d63ec21177f84b4cc7d431cff))
* **internal:** remove some duplicated imports ([#547](https://github.com/Finch-API/finch-api-python/issues/547)) ([7bfcea0](https://github.com/Finch-API/finch-api-python/commit/7bfcea02a906fb2e2d811186b4bc2f46e1ac61e0))
* **internal:** updated imports ([#548](https://github.com/Finch-API/finch-api-python/issues/548)) ([aa2ca67](https://github.com/Finch-API/finch-api-python/commit/aa2ca675334c9058759c96662219e2efc3d35aa8))
* make the `Omit` type public ([#538](https://github.com/Finch-API/finch-api-python/issues/538)) ([02a3af8](https://github.com/Finch-API/finch-api-python/commit/02a3af89c699d07d41c3ca28e8e92082935254ca))


### Documentation

* **readme:** example snippet for client context manager ([#550](https://github.com/Finch-API/finch-api-python/issues/550)) ([a5fff19](https://github.com/Finch-API/finch-api-python/commit/a5fff19f34774cef04415d99b744258f8e966c36))
* **readme:** fix http client proxies example ([#541](https://github.com/Finch-API/finch-api-python/issues/541)) ([35049ae](https://github.com/Finch-API/finch-api-python/commit/35049aefde2604411e4ecc5b8abaf1cc9a327164))

## 1.11.0 (2024-11-28)

Full Changelog: [v1.10.1...v1.11.0](https://github.com/Finch-API/finch-api-python/compare/v1.10.1...v1.11.0)
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,19 @@ can also get all the extra fields on the Pydantic model as a dict with

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

- Support for proxies
- Custom transports
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
import httpx
from finch import Finch, DefaultHttpxClient

client = Finch(
# Or use the `FINCH_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Expand All @@ -406,6 +407,16 @@ client.with_options(http_client=DefaultHttpxClient(...))

By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.

```py
from finch import Finch

with Finch() as client:
# make requests here
...

# HTTP client is now closed
```

## Versioning

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "finch-api"
version = "1.11.0"
version = "1.12.0"
description = "The official Python library for the Finch API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -10,7 +10,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.7, <5",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
7 changes: 4 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
pydantic==2.9.2
pydantic==2.10.3
# via finch-api
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.380
pyright==1.1.390
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down Expand Up @@ -97,6 +97,7 @@ typing-extensions==4.12.2
# via mypy
# via pydantic
# via pydantic-core
# via pyright
virtualenv==20.24.5
# via nox
zipp==3.17.0
Expand Down
4 changes: 2 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
pydantic==2.9.2
pydantic==2.10.3
# via finch-api
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
sniffio==1.3.0
# via anyio
Expand Down
3 changes: 2 additions & 1 deletion src/finch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from . import types
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import Finch, Client, Stream, Timeout, Transport, AsyncFinch, AsyncClient, AsyncStream, RequestOptions
from ._models import BaseModel
Expand Down Expand Up @@ -36,6 +36,7 @@
"ProxiesTypes",
"NotGiven",
"NOT_GIVEN",
"Omit",
"FinchError",
"APIError",
"APIStatusError",
Expand Down
174 changes: 86 additions & 88 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import httpx

from . import resources, _exceptions
from . import _exceptions
from ._qs import Querystring
from ._types import (
NOT_GIVEN,
Expand All @@ -27,6 +27,7 @@
get_async_library,
)
from ._version import __version__
from .resources import account, webhooks, providers, access_tokens, request_forwarding
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError
from ._base_client import (
Expand All @@ -37,31 +38,26 @@
SyncHttpxClientWrapper,
AsyncHttpxClientWrapper,
)
from .resources.hris import hris
from .resources.jobs import jobs
from .resources.connect import connect
from .resources.payroll import payroll
from .resources.sandbox import sandbox

__all__ = [
"Timeout",
"Transport",
"ProxiesTypes",
"RequestOptions",
"resources",
"Finch",
"AsyncFinch",
"Client",
"AsyncClient",
]
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Finch", "AsyncFinch", "Client", "AsyncClient"]


class Finch(SyncAPIClient):
access_tokens: resources.AccessTokens
hris: resources.HRIS
providers: resources.Providers
account: resources.Account
webhooks: resources.Webhooks
request_forwarding: resources.RequestForwarding
jobs: resources.Jobs
sandbox: resources.Sandbox
payroll: resources.Payroll
connect: resources.Connect
access_tokens: access_tokens.AccessTokens
hris: hris.HRIS
providers: providers.Providers
account: account.Account
webhooks: webhooks.Webhooks
request_forwarding: request_forwarding.RequestForwarding
jobs: jobs.Jobs
sandbox: sandbox.Sandbox
payroll: payroll.Payroll
connect: connect.Connect
with_raw_response: FinchWithRawResponse
with_streaming_response: FinchWithStreamedResponse

Expand Down Expand Up @@ -143,16 +139,16 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.access_tokens = resources.AccessTokens(self)
self.hris = resources.HRIS(self)
self.providers = resources.Providers(self)
self.account = resources.Account(self)
self.webhooks = resources.Webhooks(self)
self.request_forwarding = resources.RequestForwarding(self)
self.jobs = resources.Jobs(self)
self.sandbox = resources.Sandbox(self)
self.payroll = resources.Payroll(self)
self.connect = resources.Connect(self)
self.access_tokens = access_tokens.AccessTokens(self)
self.hris = hris.HRIS(self)
self.providers = providers.Providers(self)
self.account = account.Account(self)
self.webhooks = webhooks.Webhooks(self)
self.request_forwarding = request_forwarding.RequestForwarding(self)
self.jobs = jobs.Jobs(self)
self.sandbox = sandbox.Sandbox(self)
self.payroll = payroll.Payroll(self)
self.connect = connect.Connect(self)
self.with_raw_response = FinchWithRawResponse(self)
self.with_streaming_response = FinchWithStreamedResponse(self)

Expand Down Expand Up @@ -388,16 +384,16 @@ def _make_status_error(


class AsyncFinch(AsyncAPIClient):
access_tokens: resources.AsyncAccessTokens
hris: resources.AsyncHRIS
providers: resources.AsyncProviders
account: resources.AsyncAccount
webhooks: resources.AsyncWebhooks
request_forwarding: resources.AsyncRequestForwarding
jobs: resources.AsyncJobs
sandbox: resources.AsyncSandbox
payroll: resources.AsyncPayroll
connect: resources.AsyncConnect
access_tokens: access_tokens.AsyncAccessTokens
hris: hris.AsyncHRIS
providers: providers.AsyncProviders
account: account.AsyncAccount
webhooks: webhooks.AsyncWebhooks
request_forwarding: request_forwarding.AsyncRequestForwarding
jobs: jobs.AsyncJobs
sandbox: sandbox.AsyncSandbox
payroll: payroll.AsyncPayroll
connect: connect.AsyncConnect
with_raw_response: AsyncFinchWithRawResponse
with_streaming_response: AsyncFinchWithStreamedResponse

Expand Down Expand Up @@ -479,16 +475,16 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.access_tokens = resources.AsyncAccessTokens(self)
self.hris = resources.AsyncHRIS(self)
self.providers = resources.AsyncProviders(self)
self.account = resources.AsyncAccount(self)
self.webhooks = resources.AsyncWebhooks(self)
self.request_forwarding = resources.AsyncRequestForwarding(self)
self.jobs = resources.AsyncJobs(self)
self.sandbox = resources.AsyncSandbox(self)
self.payroll = resources.AsyncPayroll(self)
self.connect = resources.AsyncConnect(self)
self.access_tokens = access_tokens.AsyncAccessTokens(self)
self.hris = hris.AsyncHRIS(self)
self.providers = providers.AsyncProviders(self)
self.account = account.AsyncAccount(self)
self.webhooks = webhooks.AsyncWebhooks(self)
self.request_forwarding = request_forwarding.AsyncRequestForwarding(self)
self.jobs = jobs.AsyncJobs(self)
self.sandbox = sandbox.AsyncSandbox(self)
self.payroll = payroll.AsyncPayroll(self)
self.connect = connect.AsyncConnect(self)
self.with_raw_response = AsyncFinchWithRawResponse(self)
self.with_streaming_response = AsyncFinchWithStreamedResponse(self)

Expand Down Expand Up @@ -725,54 +721,56 @@ def _make_status_error(

class FinchWithRawResponse:
def __init__(self, client: Finch) -> None:
self.access_tokens = resources.AccessTokensWithRawResponse(client.access_tokens)
self.hris = resources.HRISWithRawResponse(client.hris)
self.providers = resources.ProvidersWithRawResponse(client.providers)
self.account = resources.AccountWithRawResponse(client.account)
self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.JobsWithRawResponse(client.jobs)
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)
self.payroll = resources.PayrollWithRawResponse(client.payroll)
self.connect = resources.ConnectWithRawResponse(client.connect)
self.access_tokens = access_tokens.AccessTokensWithRawResponse(client.access_tokens)
self.hris = hris.HRISWithRawResponse(client.hris)
self.providers = providers.ProvidersWithRawResponse(client.providers)
self.account = account.AccountWithRawResponse(client.account)
self.request_forwarding = request_forwarding.RequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = jobs.JobsWithRawResponse(client.jobs)
self.sandbox = sandbox.SandboxWithRawResponse(client.sandbox)
self.payroll = payroll.PayrollWithRawResponse(client.payroll)
self.connect = connect.ConnectWithRawResponse(client.connect)


class AsyncFinchWithRawResponse:
def __init__(self, client: AsyncFinch) -> None:
self.access_tokens = resources.AsyncAccessTokensWithRawResponse(client.access_tokens)
self.hris = resources.AsyncHRISWithRawResponse(client.hris)
self.providers = resources.AsyncProvidersWithRawResponse(client.providers)
self.account = resources.AsyncAccountWithRawResponse(client.account)
self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.AsyncJobsWithRawResponse(client.jobs)
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)
self.payroll = resources.AsyncPayrollWithRawResponse(client.payroll)
self.connect = resources.AsyncConnectWithRawResponse(client.connect)
self.access_tokens = access_tokens.AsyncAccessTokensWithRawResponse(client.access_tokens)
self.hris = hris.AsyncHRISWithRawResponse(client.hris)
self.providers = providers.AsyncProvidersWithRawResponse(client.providers)
self.account = account.AsyncAccountWithRawResponse(client.account)
self.request_forwarding = request_forwarding.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = jobs.AsyncJobsWithRawResponse(client.jobs)
self.sandbox = sandbox.AsyncSandboxWithRawResponse(client.sandbox)
self.payroll = payroll.AsyncPayrollWithRawResponse(client.payroll)
self.connect = connect.AsyncConnectWithRawResponse(client.connect)


class FinchWithStreamedResponse:
def __init__(self, client: Finch) -> None:
self.access_tokens = resources.AccessTokensWithStreamingResponse(client.access_tokens)
self.hris = resources.HRISWithStreamingResponse(client.hris)
self.providers = resources.ProvidersWithStreamingResponse(client.providers)
self.account = resources.AccountWithStreamingResponse(client.account)
self.request_forwarding = resources.RequestForwardingWithStreamingResponse(client.request_forwarding)
self.jobs = resources.JobsWithStreamingResponse(client.jobs)
self.sandbox = resources.SandboxWithStreamingResponse(client.sandbox)
self.payroll = resources.PayrollWithStreamingResponse(client.payroll)
self.connect = resources.ConnectWithStreamingResponse(client.connect)
self.access_tokens = access_tokens.AccessTokensWithStreamingResponse(client.access_tokens)
self.hris = hris.HRISWithStreamingResponse(client.hris)
self.providers = providers.ProvidersWithStreamingResponse(client.providers)
self.account = account.AccountWithStreamingResponse(client.account)
self.request_forwarding = request_forwarding.RequestForwardingWithStreamingResponse(client.request_forwarding)
self.jobs = jobs.JobsWithStreamingResponse(client.jobs)
self.sandbox = sandbox.SandboxWithStreamingResponse(client.sandbox)
self.payroll = payroll.PayrollWithStreamingResponse(client.payroll)
self.connect = connect.ConnectWithStreamingResponse(client.connect)


class AsyncFinchWithStreamedResponse:
def __init__(self, client: AsyncFinch) -> None:
self.access_tokens = resources.AsyncAccessTokensWithStreamingResponse(client.access_tokens)
self.hris = resources.AsyncHRISWithStreamingResponse(client.hris)
self.providers = resources.AsyncProvidersWithStreamingResponse(client.providers)
self.account = resources.AsyncAccountWithStreamingResponse(client.account)
self.request_forwarding = resources.AsyncRequestForwardingWithStreamingResponse(client.request_forwarding)
self.jobs = resources.AsyncJobsWithStreamingResponse(client.jobs)
self.sandbox = resources.AsyncSandboxWithStreamingResponse(client.sandbox)
self.payroll = resources.AsyncPayrollWithStreamingResponse(client.payroll)
self.connect = resources.AsyncConnectWithStreamingResponse(client.connect)
self.access_tokens = access_tokens.AsyncAccessTokensWithStreamingResponse(client.access_tokens)
self.hris = hris.AsyncHRISWithStreamingResponse(client.hris)
self.providers = providers.AsyncProvidersWithStreamingResponse(client.providers)
self.account = account.AsyncAccountWithStreamingResponse(client.account)
self.request_forwarding = request_forwarding.AsyncRequestForwardingWithStreamingResponse(
client.request_forwarding
)
self.jobs = jobs.AsyncJobsWithStreamingResponse(client.jobs)
self.sandbox = sandbox.AsyncSandboxWithStreamingResponse(client.sandbox)
self.payroll = payroll.AsyncPayrollWithStreamingResponse(client.payroll)
self.connect = connect.AsyncConnectWithStreamingResponse(client.connect)


Client = Finch
Expand Down
Loading
Loading