Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/whopio/whopsdk-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

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: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.WHOP_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'whopio/whopsdk-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.WHOP_PYPI_TOKEN || secrets.PYPI_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 76
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-493b08fc2ae996eaf1758fa74f56163b2e40d4e1abeaa9672b8d1a039df30d75.yml
openapi_spec_hash: 212470480a88cabb38a58b5b6867c733
config_hash: 544517bd5d21c8f0df57292359ed31e4
config_hash: d72e5036b7f668d3a99a5a96248c4052
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Changelog

## 0.0.1 (2025-10-16)

Full Changelog: [v0.0.1...v0.0.1](https://github.com/whopio/whopsdk-python/compare/v0.0.1...v0.0.1)

### Features

* **api:** add pagination ([cca20a0](https://github.com/whopio/whopsdk-python/commit/cca20a093df670d6f5fe55e78c741770b774848b))
* **api:** api update ([ede5834](https://github.com/whopio/whopsdk-python/commit/ede58347affb1212ee28e9f6c0cd4ad4cbc623e3))
* **api:** api update ([dea9ff3](https://github.com/whopio/whopsdk-python/commit/dea9ff31a3eb4a13c0495b21920fe15c89d08286))
* **api:** api update ([5c15603](https://github.com/whopio/whopsdk-python/commit/5c156032a6e24944bbb86f50382589ebc6f0cfbd))
* **api:** api update ([430272f](https://github.com/whopio/whopsdk-python/commit/430272f320ab8f916f47734eeb19a8fe67ac8577))
* **api:** api update ([c647c8e](https://github.com/whopio/whopsdk-python/commit/c647c8ed07e312dcc69a9b219800ab9c311022d0))
* **api:** api update ([ce3f9b6](https://github.com/whopio/whopsdk-python/commit/ce3f9b6ed25f68f5c620fbd3f211691308df24d9))
* **api:** api update ([130334e](https://github.com/whopio/whopsdk-python/commit/130334e85ad9731a64d4ef8c7afcb5362eed6f4d))
* **api:** api update ([95569a2](https://github.com/whopio/whopsdk-python/commit/95569a2d85672edd68c0770cf029c93808ecee5c))
* **api:** api update ([1e4d054](https://github.com/whopio/whopsdk-python/commit/1e4d05465e6b1d5ce9711dd6c3cfb6ffbccec0d7))
* **api:** api update ([a4087f9](https://github.com/whopio/whopsdk-python/commit/a4087f9a788febc82df09ef1ffde3b41aa5c3eb2))
* **api:** api update ([bbc3f3e](https://github.com/whopio/whopsdk-python/commit/bbc3f3e13fd41728877da8ab37c1002a336add9c))
* **api:** api update ([2078d4d](https://github.com/whopio/whopsdk-python/commit/2078d4dd7a4bd57d35a7c236c00c1692dfa1c3e3))
* **api:** api update ([0ae44e0](https://github.com/whopio/whopsdk-python/commit/0ae44e054d52c961863d5bb964c4ac8cd4d8ccf2))
* **api:** api update ([f96a9fa](https://github.com/whopio/whopsdk-python/commit/f96a9fade2077985f3a57a564fcf5d3a2a4ee247))
* **api:** api update ([6229709](https://github.com/whopio/whopsdk-python/commit/6229709ab174b897557891d2f8b9e8d1dd4f850f))
* **api:** api update ([a05758f](https://github.com/whopio/whopsdk-python/commit/a05758f1823ea4aba6f0124816432dcb1ad854ec))
* **api:** api update ([5826789](https://github.com/whopio/whopsdk-python/commit/5826789f3441d29195e1f9a50dcc5a8dfa823bd7))
* **api:** api update ([3b5313b](https://github.com/whopio/whopsdk-python/commit/3b5313ba1ba150dbc7bd0ba09ac0e7db3871add4))
* **api:** api update ([b111425](https://github.com/whopio/whopsdk-python/commit/b111425bddc392221ae058427e04f52b50e79f6a))
* **api:** api update ([1196432](https://github.com/whopio/whopsdk-python/commit/11964327da075908f521328225ee2d9f0a5d08c4))
* **api:** api update ([224d45a](https://github.com/whopio/whopsdk-python/commit/224d45a1b17ea90876591c55c2fd48f2606412a6))
* **api:** api update ([fcf595c](https://github.com/whopio/whopsdk-python/commit/fcf595cbeda1c35d183aa4b190d5b03f59d1af13))
* **api:** api update ([b15bf19](https://github.com/whopio/whopsdk-python/commit/b15bf195a340cc5dc94ed40eea9077c26705e91b))
* **api:** api update ([082a644](https://github.com/whopio/whopsdk-python/commit/082a644a872f6363f2e4f2065c66cb8530010815))
* **api:** api update ([2317b5a](https://github.com/whopio/whopsdk-python/commit/2317b5a5dfd31494dde3c654ee516438111d6e5d))
* **api:** api update ([bf60366](https://github.com/whopio/whopsdk-python/commit/bf60366c5dd32d0ea75c1b1e19a0c3fde03766fd))
* **api:** api update ([decb5db](https://github.com/whopio/whopsdk-python/commit/decb5dbf980d39c1b22294b931f51cddb7471669))
* **api:** api update ([7873742](https://github.com/whopio/whopsdk-python/commit/78737422c7dbb74d5de60570ce1c0beb9b5133d5))
* **api:** api update ([9dd4b20](https://github.com/whopio/whopsdk-python/commit/9dd4b209ba2faf9f0672b82408c41a05957778ae))
* **api:** api update ([2586ba0](https://github.com/whopio/whopsdk-python/commit/2586ba01139d748b91b6568a5b1646d291b058d4))
* **api:** api update ([c5c046d](https://github.com/whopio/whopsdk-python/commit/c5c046de999a35015cabec8d359dc8eb9d7e7cef))
* **api:** api update ([afbfc7c](https://github.com/whopio/whopsdk-python/commit/afbfc7cda33ececc5d32a68b61eb1bdce25d440d))
* **api:** api update ([684a4d2](https://github.com/whopio/whopsdk-python/commit/684a4d29083abea1924abe1d476566cea4836229))
* **api:** api update ([5eb68c8](https://github.com/whopio/whopsdk-python/commit/5eb68c8b5e834cb5d41b4ef6d92239180552068f))
* **api:** api update ([2777c1e](https://github.com/whopio/whopsdk-python/commit/2777c1ee8fa2b7568a5f7aa3ed7f6214e73e151e))
* **api:** api update ([522da9e](https://github.com/whopio/whopsdk-python/commit/522da9e0d26dddf66515450f89d6c3cd07728ec4))
* **api:** api update ([310859a](https://github.com/whopio/whopsdk-python/commit/310859a9111d682694c3c0f9146aebe90b8738f6))
* **api:** api update ([f8c7f12](https://github.com/whopio/whopsdk-python/commit/f8c7f1231bf24f1e6ee8217a604b7f7a26369e42))
* **api:** api update ([14d6686](https://github.com/whopio/whopsdk-python/commit/14d6686006244af27c8484222bfee7ca7797946a))
* **api:** api update ([e8ad1b6](https://github.com/whopio/whopsdk-python/commit/e8ad1b65c379c83598ab5e3df4323375effb2013))
* **api:** api update ([f0ddc58](https://github.com/whopio/whopsdk-python/commit/f0ddc5848b1123a311901c2f18dae20a8f111b3e))
* **api:** manual update ([6616062](https://github.com/whopio/whopsdk-python/commit/661606245f75b1e051eb8261eb25e3f0a9ba7530))
* **api:** manual updates ([8bd5020](https://github.com/whopio/whopsdk-python/commit/8bd5020184f7188182bd6bbefed5b57612576c0d))
* **api:** manual updates ([7f0eeb0](https://github.com/whopio/whopsdk-python/commit/7f0eeb0660a892ad93cf0100f3a54a4883462490))
* **api:** manual updates ([19708a9](https://github.com/whopio/whopsdk-python/commit/19708a9b9f9bff55b176f792f7c0a42254879e61))
* **api:** manual updates ([5922b82](https://github.com/whopio/whopsdk-python/commit/5922b825b2124d45f4497fe87c49b3ab9e956bc4))
* **api:** manual updates ([a4cfb11](https://github.com/whopio/whopsdk-python/commit/a4cfb111221fa2cf876c16f6fcef29ed85aca703))
* **api:** manual updates ([4934302](https://github.com/whopio/whopsdk-python/commit/4934302bdc2aeecfeadc29f8bb7f0b781e359998))
* **api:** manual updates ([12a0566](https://github.com/whopio/whopsdk-python/commit/12a0566c02d13586c06f332ed00432cb217add25))
* **api:** manual updates ([b00456a](https://github.com/whopio/whopsdk-python/commit/b00456a6975957c8cea04347b64a5193f4ab1677))
* **api:** manual updates ([a8033bc](https://github.com/whopio/whopsdk-python/commit/a8033bcbc16920240576131cf1da1915ba9d02fd))
* **api:** manual updates ([063fdca](https://github.com/whopio/whopsdk-python/commit/063fdcae5471d877d2f61dd375a9d9864ca2c4c6))
* **api:** manual updates ([1f249fc](https://github.com/whopio/whopsdk-python/commit/1f249fcad56842b606efba8ee9a9fd2cfb3a5209))
* **api:** manual updates ([a4a0aa7](https://github.com/whopio/whopsdk-python/commit/a4a0aa722072b80194fd11eb3b8008816eb7b618))
* **api:** manual updates ([cf6f5db](https://github.com/whopio/whopsdk-python/commit/cf6f5db50900489042ceba730baf9ebd326457b6))
* **api:** manual updates ([62f7869](https://github.com/whopio/whopsdk-python/commit/62f7869124a4b80b6973601ded3499b30d3ada62))
* **api:** manual updates ([5d81435](https://github.com/whopio/whopsdk-python/commit/5d8143583c4a800e1e83d053c6729ea803adb609))
* **api:** manual updates ([606b0f0](https://github.com/whopio/whopsdk-python/commit/606b0f05c079260b7ae12264ae0059198ac7afc9))
* **api:** manual updates ([455802f](https://github.com/whopio/whopsdk-python/commit/455802f91d272be82d13cfcd3c1d92db043c7c70))
* **api:** manual updates ([821148f](https://github.com/whopio/whopsdk-python/commit/821148f771ab4f068497d781ea42034c083667e0))
* **api:** manual updates ([724a475](https://github.com/whopio/whopsdk-python/commit/724a475899b0c22f5b5f500f12b0df2e87526b83))
* **api:** manual updates ([96fd8b2](https://github.com/whopio/whopsdk-python/commit/96fd8b255e581c67c56c6f6a39f684fc8be3ed7d))
* **api:** manual updates ([6d14145](https://github.com/whopio/whopsdk-python/commit/6d14145b53350ed0d53d622d6288673331e951f1))
* **api:** manual updates ([327a856](https://github.com/whopio/whopsdk-python/commit/327a8565176ce86b1af0c679d9db5499deea6e88))
* **api:** manual updates ([72ab133](https://github.com/whopio/whopsdk-python/commit/72ab133134a390ae5395e07ebf1459df666d859e))


### Chores

* configure new SDK language ([ebf6304](https://github.com/whopio/whopsdk-python/commit/ebf63045bd54a7988c1f0b2867224b7003f3fdef))
* **internal:** detect missing future annotations with ruff ([6e080b8](https://github.com/whopio/whopsdk-python/commit/6e080b854f8e403bddee5077d6891ae53a99ac08))
* update SDK settings ([c9b0496](https://github.com/whopio/whopsdk-python/commit/c9b049612845640f2637e2139a4e6a5e61b960d8))
* update SDK settings ([fc59c60](https://github.com/whopio/whopsdk-python/commit/fc59c6018a3ff8c9e1a667ece0021676062fbed3))
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock

Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
result in merge conflicts between manual patches and changes from the generator. The generator will never
modify the contents of the `src/whopsdk/lib/` and `examples/` directories.
modify the contents of the `src/whop_sdk/lib/` and `examples/` directories.

## Adding and running examples

Expand All @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ pip install git+ssh://git@github.com/stainless-sdks/whopsdk-python.git
$ pip install git+ssh://git@github.com/whopio/whopsdk-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand Down Expand Up @@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/whopsdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/whopio/whopsdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
63 changes: 30 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Whop Python API library

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

The Whop Python library provides convenient access to the Whop REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand All @@ -16,20 +16,17 @@ The REST API documentation can be found on [docs.whop.com](https://docs.whop.com
## Installation

```sh
# install from this staging repo
pip install git+ssh://git@github.com/stainless-sdks/whopsdk-python.git
# install from PyPI
pip install whop-sdk
```

> [!NOTE]
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install whopsdk`

## Usage

The full API of this library can be found in [api.md](api.md).

```python
import os
from whopsdk import Whop
from whop_sdk import Whop

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -54,7 +51,7 @@ Simply import `AsyncWhop` instead of `Whop` and use `await` with each API call:
```python
import os
import asyncio
from whopsdk import AsyncWhop
from whop_sdk import AsyncWhop

client = AsyncWhop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -81,16 +78,16 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
You can enable this by installing `aiohttp`:

```sh
# install from this staging repo
pip install 'whopsdk[aiohttp] @ git+ssh://git@github.com/stainless-sdks/whopsdk-python.git'
# install from PyPI
pip install whop-sdk[aiohttp]
```

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

```python
import asyncio
from whopsdk import DefaultAioHttpClient
from whopsdk import AsyncWhop
from whop_sdk import DefaultAioHttpClient
from whop_sdk import AsyncWhop


async def main() -> None:
Expand Down Expand Up @@ -124,7 +121,7 @@ List methods in the Whop API are paginated.
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:

```python
from whopsdk import Whop
from whop_sdk import Whop

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -144,7 +141,7 @@ Or, asynchronously:

```python
import asyncio
from whopsdk import AsyncWhop
from whop_sdk import AsyncWhop

client = AsyncWhop(
app_id="app_xxxxxxxxxxxxxx",
Expand Down Expand Up @@ -197,7 +194,7 @@ for payment in first_page.data:
Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from whopsdk import Whop
from whop_sdk import Whop

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -212,16 +209,16 @@ print(app.icon)

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `whopsdk.APIConnectionError` is raised.
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `whop_sdk.APIConnectionError` is raised.

When the API returns a non-success status code (that is, 4xx or 5xx
response), a subclass of `whopsdk.APIStatusError` is raised, containing `status_code` and `response` properties.
response), a subclass of `whop_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.

All errors inherit from `whopsdk.APIError`.
All errors inherit from `whop_sdk.APIError`.

```python
import whopsdk
from whopsdk import Whop
import whop_sdk
from whop_sdk import Whop

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -231,12 +228,12 @@ try:
client.payments.list(
company_id="biz_xxxxxxxxxxxxxx",
)
except whopsdk.APIConnectionError as e:
except whop_sdk.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except whopsdk.RateLimitError as e:
except whop_sdk.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except whopsdk.APIStatusError as e:
except whop_sdk.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
Expand Down Expand Up @@ -264,7 +261,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
You can use the `max_retries` option to configure or disable retry settings:

```python
from whopsdk import Whop
from whop_sdk import Whop

# Configure the default for all requests:
client = Whop(
Expand All @@ -285,7 +282,7 @@ By default requests time out after 1 minute. You can configure this with a `time
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from whopsdk import Whop
from whop_sdk import Whop

# Configure the default for all requests:
client = Whop(
Expand Down Expand Up @@ -341,7 +338,7 @@ if response.my_field is None:
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,

```py
from whopsdk import Whop
from whop_sdk import Whop

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -355,9 +352,9 @@ payment = response.parse() # get the object that `payments.list()` would have r
print(payment.id)
```

These methods return an [`APIResponse`](https://github.com/stainless-sdks/whopsdk-python/tree/main/src/whopsdk/_response.py) object.
These methods return an [`APIResponse`](https://github.com/whopio/whopsdk-python/tree/main/src/whop_sdk/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/whopsdk-python/tree/main/src/whopsdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
The async client returns an [`AsyncAPIResponse`](https://github.com/whopio/whopsdk-python/tree/main/src/whop_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand Down Expand Up @@ -421,7 +418,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c

```python
import httpx
from whopsdk import Whop, DefaultHttpxClient
from whop_sdk import Whop, DefaultHttpxClient

client = Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -445,7 +442,7 @@ 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 whopsdk import Whop
from whop_sdk import Whop

with Whop(
app_id="app_xxxxxxxxxxxxxx",
Expand All @@ -466,7 +463,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/whopsdk-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/whopio/whopsdk-python/issues) with questions, bugs, or suggestions.

### Determining the installed version

Expand All @@ -475,8 +472,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
You can determine the version that is being used at runtime with:

```py
import whopsdk
print(whopsdk.__version__)
import whop_sdk
print(whop_sdk.__version__)
```

## Requirements
Expand Down
Loading