Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2afb698
chore(internal): bump dependencies
stainless-app[bot] Feb 10, 2026
8f891ca
chore(internal): fix lint error on Python 3.14
stainless-app[bot] Feb 12, 2026
691c9c6
chore: format all `api.md` files
stainless-app[bot] Feb 13, 2026
02c10f5
chore(internal): remove mock server code
stainless-app[bot] Feb 20, 2026
4b7594f
chore: update mock server docs
stainless-app[bot] Feb 20, 2026
c83d52b
chore(internal): add request options to SSE classes
stainless-app[bot] Feb 24, 2026
a298056
chore(internal): make `test_proxy_environment_variables` more resilient
stainless-app[bot] Feb 24, 2026
a2e60c5
chore(internal): make `test_proxy_environment_variables` more resilie…
stainless-app[bot] Feb 25, 2026
bcb729d
codegen metadata
stainless-app[bot] Mar 31, 2026
3cd15f0
feat(api): api update
stainless-app[bot] Apr 7, 2026
c48bfd7
chore(internal): codegen related update
stainless-app[bot] Apr 8, 2026
b344fe8
chore(internal): codegen related update
stainless-app[bot] Apr 11, 2026
6692c9b
chore(internal): codegen related update
stainless-app[bot] Apr 18, 2026
c544f50
chore(internal): codegen related update
stainless-app[bot] Apr 23, 2026
2a9b858
codegen metadata
stainless-app[bot] Apr 26, 2026
ca33256
chore(internal): codegen related update
stainless-app[bot] Apr 28, 2026
1cd1130
chore(internal): codegen related update
stainless-app[bot] May 1, 2026
9e205f4
chore(internal): codegen related update
stainless-app[bot] May 9, 2026
e5b6f83
feat(api): api update
stainless-app[bot] May 9, 2026
12bc0a4
chore(internal): codegen related update
stainless-app[bot] May 12, 2026
9d762c1
chore(internal): codegen related update
stainless-app[bot] May 13, 2026
d14ac86
feat(api): api update
stainless-app[bot] May 14, 2026
32f1918
release: 1.3.0
stainless-app[bot] May 14, 2026
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
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -17,9 +19,9 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/brapi-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install Rye
run: |
Expand All @@ -36,15 +38,15 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/brapi-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install Rye
run: |
Expand All @@ -61,14 +63,18 @@ jobs:
run: rye build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/brapi-python'
if: |-
github.repository == 'stainless-sdks/brapi-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/brapi-python'
if: |-
github.repository == 'stainless-sdks/brapi-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand All @@ -81,7 +87,7 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/brapi-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install Rye
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install Rye
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.repository == 'brapi-dev/brapi-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Check release environment
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
_dev

__pycache__
Expand Down
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.2.0"
".": "1.3.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/alisson%2Fbrapi-76a60a630b8eaac37bdec27ffec5cbdf6640fb884186adb08211f1b81832c075.yml
openapi_spec_hash: 51fab4b9fd59ce7421f3fdf03644c987
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/alisson/brapi-de3d30399876b2fbeef7ab49e0795a0284ce30db2429b708645f4f38c7c4340c.yml
openapi_spec_hash: 36b4e6d8aab0be7695d66d369b3cee94
config_hash: 6f10a67950f65bf850612b59838ad03b
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## 1.3.0 (2026-05-14)

Full Changelog: [v1.2.0...v1.3.0](https://github.com/brapi-dev/brapi-python/compare/v1.2.0...v1.3.0)

### Features

* **api:** api update ([d14ac86](https://github.com/brapi-dev/brapi-python/commit/d14ac86534b391d76741c66288b6de13587b04c8))
* **api:** api update ([e5b6f83](https://github.com/brapi-dev/brapi-python/commit/e5b6f83dfaa8e56f3ee5f8d3cbb63f20ef134d75))
* **api:** api update ([3cd15f0](https://github.com/brapi-dev/brapi-python/commit/3cd15f03d4ef87c43d54a307b5de78cb1668d5fd))


### Chores

* format all `api.md` files ([691c9c6](https://github.com/brapi-dev/brapi-python/commit/691c9c699beb5779f2593de827024d861963eb73))
* **internal:** add request options to SSE classes ([c83d52b](https://github.com/brapi-dev/brapi-python/commit/c83d52b1acbd6d9f062aa08aea4633d2ff465ab3))
* **internal:** bump dependencies ([2afb698](https://github.com/brapi-dev/brapi-python/commit/2afb69816a7f44ee93344c61f94eb86f4c340e9f))
* **internal:** codegen related update ([9d762c1](https://github.com/brapi-dev/brapi-python/commit/9d762c157eedd219a2b2b3759071ac25b8d369a2))
* **internal:** codegen related update ([12bc0a4](https://github.com/brapi-dev/brapi-python/commit/12bc0a45ac8548a0088485b390d2b62b5c5d4067))
* **internal:** codegen related update ([9e205f4](https://github.com/brapi-dev/brapi-python/commit/9e205f4d519846a0df06ff9692614ddb8db7cd68))
* **internal:** codegen related update ([1cd1130](https://github.com/brapi-dev/brapi-python/commit/1cd11301a9c48f7e87080f3c0fed1b7ffe65d24e))
* **internal:** codegen related update ([ca33256](https://github.com/brapi-dev/brapi-python/commit/ca33256ebbce63bc4d1704fed00dfec12fcaee3e))
* **internal:** codegen related update ([c544f50](https://github.com/brapi-dev/brapi-python/commit/c544f50c8fd0ffe00e9736da46380290f355ead6))
* **internal:** codegen related update ([6692c9b](https://github.com/brapi-dev/brapi-python/commit/6692c9b20d96d03d072e1db6b56bbcdfe1d852a5))
* **internal:** codegen related update ([b344fe8](https://github.com/brapi-dev/brapi-python/commit/b344fe8ef180aa53bcba7cae0ab1736031f79941))
* **internal:** codegen related update ([c48bfd7](https://github.com/brapi-dev/brapi-python/commit/c48bfd77ef22184d9befd319f68a4653e68f03b2))
* **internal:** fix lint error on Python 3.14 ([8f891ca](https://github.com/brapi-dev/brapi-python/commit/8f891ca4cd532ff0b5bc2ea4748868189d1ac5bf))
* **internal:** make `test_proxy_environment_variables` more resilient ([a298056](https://github.com/brapi-dev/brapi-python/commit/a298056128baf138f8493c80d34ecc8d67af02fa))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([a2e60c5](https://github.com/brapi-dev/brapi-python/commit/a2e60c5bb3762cf3de9e7bb7d54a3e6b91a77fb4))
* **internal:** remove mock server code ([02c10f5](https://github.com/brapi-dev/brapi-python/commit/02c10f56762ea1456bc03934ebddd6c6f78fef81))
* update mock server docs ([4b7594f](https://github.com/brapi-dev/brapi-python/commit/4b7594fc083f530ddddeaa052a641efaccaf8d6b))

## 1.2.0 (2026-01-30)

Full Changelog: [v1.1.0...v1.2.0](https://github.com/brapi-dev/brapi-python/compare/v1.1.0...v1.2.0)
Expand Down
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ $ pip install ./path-to-wheel-file.whl

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```sh
# you will need npm installed
$ npx prism mock path/to/your/openapi.yml
```

```sh
$ ./scripts/test
```
Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ pip install brapi
The full API of this library can be found in [api.md](api.md).

```python
import os
from brapi import Brapi

client = Brapi(
api_key=os.environ.get("BRAPI_API_KEY"), # This is the default and can be omitted
api_key="My API Key",
# defaults to "production".
environment="environment_1",
)
Expand All @@ -40,22 +39,16 @@ quote = client.quote.retrieve(
print(quote.requested_at)
```

While you can provide an `api_key` keyword argument,
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
to add `BRAPI_API_KEY="My API Key"` to your `.env` file
so that your API Key is not stored in source control.

## Async usage

Simply import `AsyncBrapi` instead of `Brapi` and use `await` with each API call:

```python
import os
import asyncio
from brapi import AsyncBrapi

client = AsyncBrapi(
api_key=os.environ.get("BRAPI_API_KEY"), # This is the default and can be omitted
api_key="My API Key",
# defaults to "production".
environment="environment_1",
)
Expand Down Expand Up @@ -87,15 +80,14 @@ pip install brapi[aiohttp]
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import os
import asyncio
from brapi import DefaultAioHttpClient
from brapi import AsyncBrapi


async def main() -> None:
async with AsyncBrapi(
api_key=os.environ.get("BRAPI_API_KEY"), # This is the default and can be omitted
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
quote = await client.quote.retrieve(
Expand Down Expand Up @@ -129,7 +121,9 @@ All errors inherit from `brapi.APIError`.
import brapi
from brapi import Brapi

client = Brapi()
client = Brapi(
api_key="My API Key",
)

try:
client.quote.retrieve(
Expand Down Expand Up @@ -172,6 +166,7 @@ from brapi import Brapi

# Configure the default for all requests:
client = Brapi(
api_key="My API Key",
# default is 2
max_retries=0,
)
Expand All @@ -192,12 +187,14 @@ from brapi import Brapi

# Configure the default for all requests:
client = Brapi(
api_key="My API Key",
# 20 seconds (default is 1 minute)
timeout=20.0,
)

# More granular control:
client = Brapi(
api_key="My API Key",
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
)

Expand Down Expand Up @@ -244,7 +241,9 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
```py
from brapi import Brapi

client = Brapi()
client = Brapi(
api_key="My API Key",
)
response = client.quote.with_raw_response.retrieve(
tickers="REPLACE_ME",
)
Expand Down Expand Up @@ -323,6 +322,7 @@ import httpx
from brapi import Brapi, DefaultHttpxClient

client = Brapi(
api_key="My API Key",
# Or use the `BRAPI_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
Expand All @@ -345,7 +345,9 @@ By default the library closes underlying HTTP connections whenever the client is
```py
from brapi import Brapi

with Brapi() as client:
with Brapi(
api_key="My API Key",
) as client:
# make requests here
...

Expand Down
8 changes: 2 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Types:
```python
from brapi.types import (
BalanceSheetEntry,
CashflowEntry,
DefaultKeyStatisticsEntry,
FinancialDataEntry,
IncomeStatementEntry,
ValueAddedEntry,
QuoteRetrieveResponse,
QuoteListResponse,
)
Expand Down Expand Up @@ -71,7 +67,7 @@ from brapi.types.v2 import InflationRetrieveResponse, InflationListAvailableResp
Methods:

- <code title="get /api/v2/inflation">client.v2.inflation.<a href="./src/brapi/resources/v2/inflation.py">retrieve</a>(\*\*<a href="src/brapi/types/v2/inflation_retrieve_params.py">params</a>) -> <a href="./src/brapi/types/v2/inflation_retrieve_response.py">InflationRetrieveResponse</a></code>
- <code title="get /api/v2/inflation/available">client.v2.inflation.<a href="./src/brapi/resources/v2/inflation.py">list_available</a>(\*\*<a href="src/brapi/types/v2/inflation_list_available_params.py">params</a>) -> <a href="./src/brapi/types/v2/inflation_list_available_response.py">InflationListAvailableResponse</a></code>
- <code title="get /api/v2/inflation/available">client.v2.inflation.<a href="./src/brapi/resources/v2/inflation.py">list_available</a>() -> <a href="./src/brapi/types/v2/inflation_list_available_response.py">InflationListAvailableResponse</a></code>

## PrimeRate

Expand All @@ -84,4 +80,4 @@ from brapi.types.v2 import PrimeRateRetrieveResponse, PrimeRateListAvailableResp
Methods:

- <code title="get /api/v2/prime-rate">client.v2.prime_rate.<a href="./src/brapi/resources/v2/prime_rate.py">retrieve</a>(\*\*<a href="src/brapi/types/v2/prime_rate_retrieve_params.py">params</a>) -> <a href="./src/brapi/types/v2/prime_rate_retrieve_response.py">PrimeRateRetrieveResponse</a></code>
- <code title="get /api/v2/prime-rate/available">client.v2.prime_rate.<a href="./src/brapi/resources/v2/prime_rate.py">list_available</a>(\*\*<a href="src/brapi/types/v2/prime_rate_list_available_params.py">params</a>) -> <a href="./src/brapi/types/v2/prime_rate_list_available_response.py">PrimeRateListAvailableResponse</a></code>
- <code title="get /api/v2/prime-rate/available">client.v2.prime_rate.<a href="./src/brapi/resources/v2/prime_rate.py">list_available</a>() -> <a href="./src/brapi/types/v2/prime_rate_list_available_response.py">PrimeRateListAvailableResponse</a></code>
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "brapi"
version = "1.2.0"
version = "1.3.0"
description = "The official Python library for the brapi API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -11,7 +11,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"typing-extensions>=4.14, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down Expand Up @@ -69,7 +69,7 @@ format = { chain = [
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'"
"format:ruff" = "ruff format"

"lint" = { chain = [
Expand Down Expand Up @@ -168,7 +168,7 @@ show_error_codes = true
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ['src/brapi/_files.py', '_dev/.*.py', 'tests/.*']
exclude = ["src/brapi/_files.py", "_dev/.*.py", "tests/.*"]

strict_equality = true
implicit_reexport = true
Expand Down
Loading