Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d745025
chore(docs): remove reference to rye shell
stainless-app[bot] Jun 3, 2025
0673d97
chore(docs): remove unnecessary param examples
stainless-app[bot] Jun 3, 2025
9df418b
feat(client): add follow_redirects request option
stainless-app[bot] Jun 3, 2025
02ad96f
chore(tests): run tests in parallel
stainless-app[bot] Jun 13, 2025
539d6bf
fix(client): correctly parse binary response | stream
stainless-app[bot] Jun 13, 2025
8852f4b
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 17, 2025
bfbab5c
chore(internal): update conftest.py
stainless-app[bot] Jun 17, 2025
cc425b5
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
a32bd73
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
e0ac852
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 18, 2025
f3b6260
docs(client): fix httpx.Timeout documentation reference
stainless-app[bot] Jun 19, 2025
3eb209f
feat(client): add support for aiohttp
stainless-app[bot] Jun 21, 2025
6b36079
chore(tests): skip some failing tests on the latest python versions
stainless-app[bot] Jun 24, 2025
68d96ff
fix(ci): release-doctor — report correct token name
stainless-app[bot] Jun 27, 2025
91e27a2
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jun 28, 2025
68884e8
fix(ci): correct conditional
stainless-app[bot] Jun 30, 2025
81e0486
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
eb41b78
chore(internal): codegen related update
stainless-app[bot] Jul 8, 2025
721cd0c
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
6cc8a38
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
51edf3f
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
7f5d547
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 11, 2025
51bb320
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 12, 2025
4ad1004
feat: clean up environment call outs
stainless-app[bot] Jul 15, 2025
85b43fb
fix(parsing): ignore empty metadata
stainless-app[bot] Jul 22, 2025
0f75cf3
fix(parsing): parse extra field types
stainless-app[bot] Jul 23, 2025
1490b90
release: 0.1.0-alpha.2
stainless-app[bot] Jul 23, 2025
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
26 changes: 23 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/slash-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand All @@ -30,17 +35,31 @@ jobs:
- name: Run lints
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/slash-sdk-python'
build:
if: github.repository == 'stainless-sdks/slash-sdk-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
timeout-minutes: 10
name: upload
name: build
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: rye sync --all-features

- name: Run build
run: rye build

- name: Get GitHub OIDC Token
id: github-oidc
uses: actions/github-script@v6
Expand All @@ -58,6 +77,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/slash-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

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 @@
{
".": "0.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Changelog

## 0.1.0-alpha.2 (2025-07-23)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/slashfi/slash-sdk-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* clean up environment call outs ([4ad1004](https://github.com/slashfi/slash-sdk-python/commit/4ad1004bad56af213217d78141a25c50cefb42a2))
* **client:** add follow_redirects request option ([9df418b](https://github.com/slashfi/slash-sdk-python/commit/9df418b9d18347bf14f4ed4f4dbca5db3feaf521))
* **client:** add support for aiohttp ([3eb209f](https://github.com/slashfi/slash-sdk-python/commit/3eb209fa3e453273442b521aab466f9df9b73fa5))


### Bug Fixes

* **ci:** correct conditional ([68884e8](https://github.com/slashfi/slash-sdk-python/commit/68884e8986638113fbbad9acbc30cdf234164618))
* **ci:** release-doctor — report correct token name ([68d96ff](https://github.com/slashfi/slash-sdk-python/commit/68d96ff71da2be9c21a075bd367f70ea045f2fb8))
* **client:** correctly parse binary response | stream ([539d6bf](https://github.com/slashfi/slash-sdk-python/commit/539d6bf673de7c5e22e91cf3c772d549c91b2e03))
* **client:** don't send Content-Type header on GET requests ([51bb320](https://github.com/slashfi/slash-sdk-python/commit/51bb32045c91c5012d612042cd1651f00757e588))
* **parsing:** correctly handle nested discriminated unions ([51edf3f](https://github.com/slashfi/slash-sdk-python/commit/51edf3f3aa2531739c8b8e221dae573cbb187b4c))
* **parsing:** ignore empty metadata ([85b43fb](https://github.com/slashfi/slash-sdk-python/commit/85b43fb287242201157d2802498929eff6964266))
* **parsing:** parse extra field types ([0f75cf3](https://github.com/slashfi/slash-sdk-python/commit/0f75cf32099a0a2f62e4bedfa486652df6bbce93))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([e0ac852](https://github.com/slashfi/slash-sdk-python/commit/e0ac852222cd61422abaaf500fa7c4bef0db3337))


### Chores

* **ci:** change upload type ([81e0486](https://github.com/slashfi/slash-sdk-python/commit/81e04862374726575980dc33acbb30bc4ecfccb8))
* **ci:** enable for pull requests ([cc425b5](https://github.com/slashfi/slash-sdk-python/commit/cc425b5b5d46fd3af23dbfacc61da8a8856c9d5e))
* **ci:** only run for pushes and fork pull requests ([91e27a2](https://github.com/slashfi/slash-sdk-python/commit/91e27a29542b197e2909d61ea8c2cae7b2755cb8))
* **docs:** remove reference to rye shell ([d745025](https://github.com/slashfi/slash-sdk-python/commit/d74502525553bb9c7374e4300c3c920bcc78bc3c))
* **docs:** remove unnecessary param examples ([0673d97](https://github.com/slashfi/slash-sdk-python/commit/0673d9730b1128fbaed1d143e2f573843f0c13e0))
* **internal:** bump pinned h11 dep ([721cd0c](https://github.com/slashfi/slash-sdk-python/commit/721cd0ce8f3bc83d7f4016c1418db849b41987d7))
* **internal:** codegen related update ([eb41b78](https://github.com/slashfi/slash-sdk-python/commit/eb41b787a0cb2f29ea863eb0cb9f767c6c95e7cd))
* **internal:** update conftest.py ([bfbab5c](https://github.com/slashfi/slash-sdk-python/commit/bfbab5ca00ff7a3800bc3a19c17f60556237c648))
* **package:** mark python 3.13 as supported ([6cc8a38](https://github.com/slashfi/slash-sdk-python/commit/6cc8a3889ccc88587b7738c73e2be2f6a24a056e))
* **readme:** fix version rendering on pypi ([7f5d547](https://github.com/slashfi/slash-sdk-python/commit/7f5d547e17b548a02ae09be29668d5015a2d22ce))
* **readme:** update badges ([a32bd73](https://github.com/slashfi/slash-sdk-python/commit/a32bd7368002955f1a0cc2412a4ece9e52aa159f))
* **tests:** add tests for httpx client instantiation & proxies ([8852f4b](https://github.com/slashfi/slash-sdk-python/commit/8852f4bb22390c1f3fb9dfd1542d59fce8d3fd70))
* **tests:** run tests in parallel ([02ad96f](https://github.com/slashfi/slash-sdk-python/commit/02ad96f0f240fc3a66e8b37b6360957100c26d0c))
* **tests:** skip some failing tests on the latest python versions ([6b36079](https://github.com/slashfi/slash-sdk-python/commit/6b36079b93a5e4c4ca0d1a38ed9336ab4b8687fd))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([f3b6260](https://github.com/slashfi/slash-sdk-python/commit/f3b6260b5408f2e991155c007b2b84b13f164798))

## 0.1.0-alpha.1 (2025-05-23)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/slashfi/slash-sdk-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $ rye sync --all-features
You can then run scripts using `rye run python script.py` or by activating the virtual environment:

```sh
$ rye shell
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
Expand Down
75 changes: 35 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Slash SDK Python API library

[![PyPI version](https://img.shields.io/pypi/v/slash-sdk.svg)](https://pypi.org/project/slash-sdk/)
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/slash-sdk.svg?label=pypi%20(stable))](https://pypi.org/project/slash-sdk/)

The Slash SDK Python library provides convenient access to the Slash SDK REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -64,6 +65,37 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install --pre slash-sdk[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from slash_sdk import DefaultAioHttpClient
from slash_sdk import AsyncSlashSDK


async def main() -> None:
async with AsyncSlashSDK(
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
legal_entities = await client.legal_entity.list()
print(legal_entities.items)


asyncio.run(main())
```

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
Expand All @@ -85,44 +117,7 @@ client = SlashSDK()
card = client.card.create(
name="name",
type="virtual",
spending_constraint={
"country_rule": {
"countries": ["string"],
"restriction": "allowlist",
},
"merchant_category_code_rule": {
"merchant_category_codes": ["string"],
"restriction": "allowlist",
},
"merchant_category_rule": {
"merchant_categories": ["string"],
"restriction": "allowlist",
},
"merchant_rule": {
"merchants": ["string"],
"restriction": "allowlist",
},
"spending_rule": {
"transaction_size_limit": {
"maximum": {"amount_cents": 0},
"minimum": {"amount_cents": 0},
},
"utilization_limit": {
"limit_amount": {"amount_cents": 0},
"preset": "daily",
"start_date": "startDate",
"timezone": "timezone",
},
"utilization_limit_v2": [
{
"limit_amount": {"amount_cents": 0},
"preset": "daily",
"start_date": "startDate",
"timezone": "timezone",
}
],
},
},
spending_constraint={},
)
print(card.spending_constraint)
```
Expand Down Expand Up @@ -192,7 +187,7 @@ client.with_options(max_retries=5).legal_entity.list()
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from slash_sdk import SlashSDK
Expand Down
2 changes: 1 addition & 1 deletion bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The SLASH_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "slash-sdk"
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
description = "The official Python library for the slash-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
Expand All @@ -37,6 +38,8 @@ classifiers = [
Homepage = "https://github.com/slashfi/slash-sdk-python"
Repository = "https://github.com/slashfi/slash-sdk-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]

[tool.rye]
managed = true
Expand All @@ -54,6 +57,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

[tool.rye.scripts]
Expand Down Expand Up @@ -125,7 +129,7 @@ replacement = '[\1](https://github.com/slashfi/slash-sdk-python/tree/main/\g<2>)

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
addopts = "--tb=short -n auto"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
35 changes: 33 additions & 2 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.8
# via httpx-aiohttp
# via slash-sdk
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via slash-sdk
argcomplete==3.1.2
# via nox
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -30,25 +41,37 @@ distro==1.8.0
exceptiongroup==1.2.2
# via anyio
# via pytest
execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
h11==0.14.0
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via respx
# via slash-sdk
httpx-aiohttp==0.1.8
# via slash-sdk
idna==3.4
# via anyio
# via httpx
# via yarl
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
multidict==6.4.4
# via aiohttp
# via yarl
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
Expand All @@ -63,6 +86,9 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
# via slash-sdk
pydantic-core==2.27.1
Expand All @@ -72,7 +98,9 @@ pygments==2.18.0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
# via pytest-xdist
pytest-asyncio==0.24.0
pytest-xdist==3.7.0
python-dateutil==2.8.2
# via time-machine
pytz==2023.3.post1
Expand All @@ -93,12 +121,15 @@ tomli==2.0.2
# via pytest
typing-extensions==4.12.2
# via anyio
# via multidict
# via mypy
# via pydantic
# via pydantic-core
# via pyright
# via slash-sdk
virtualenv==20.24.5
# via nox
yarl==1.20.0
# via aiohttp
zipp==3.17.0
# via importlib-metadata
Loading