Skip to content

Commit 4bd493f

Browse files
🌿 Fern Regeneration -- July 7, 2025 (#3)
SDK regeneration Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 5bfb47e commit 4bd493f

File tree

136 files changed

+20784
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+20784
-0
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: ci
2+
3+
on: [push]
4+
jobs:
5+
compile:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout repo
9+
uses: actions/checkout@v4
10+
- name: Set up python
11+
uses: actions/setup-python@v4
12+
with:
13+
python-version: 3.8
14+
- name: Bootstrap poetry
15+
run: |
16+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
17+
- name: Install dependencies
18+
run: poetry install
19+
- name: Compile
20+
run: poetry run mypy .
21+
test:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v4
26+
- name: Set up python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: 3.8
30+
- name: Bootstrap poetry
31+
run: |
32+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
33+
- name: Install dependencies
34+
run: poetry install
35+
36+
- name: Test
37+
run: poetry run pytest -rP .
38+
39+
publish:
40+
needs: [compile, test]
41+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout repo
45+
uses: actions/checkout@v4
46+
- name: Set up python
47+
uses: actions/setup-python@v4
48+
with:
49+
python-version: 3.8
50+
- name: Bootstrap poetry
51+
run: |
52+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
53+
- name: Install dependencies
54+
run: poetry install
55+
- name: Publish to pypi
56+
run: |
57+
poetry config repositories.remote https://upload.pypi.org/legacy/
58+
poetry --no-interaction -v publish --build --repository remote --username "$PYPI_USERNAME" --password "$PYPI_PASSWORD"
59+
env:
60+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
61+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

README.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Pipedream Python Library
2+
3+
[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPipedreamHQ%2Fpipedream-sdk-python)
4+
[![pypi](https://img.shields.io/pypi/v/pipedream)](https://pypi.python.org/pypi/pipedream)
5+
6+
The Pipedream Python library provides convenient access to the Pipedream API from Python.
7+
8+
## Installation
9+
10+
```sh
11+
pip install pipedream
12+
```
13+
14+
## Reference
15+
16+
A full reference for this library is available [here](https://github.com/PipedreamHQ/pipedream-sdk-python/blob/HEAD/./reference.md).
17+
18+
## Usage
19+
20+
Instantiate and use the client with the following:
21+
22+
```python
23+
from pipedream import Pipedream
24+
25+
client = Pipedream(
26+
x_pd_environment="YOUR_X_PD_ENVIRONMENT",
27+
client_id="YOUR_CLIENT_ID",
28+
client_secret="YOUR_CLIENT_SECRET",
29+
)
30+
client.accounts.create(
31+
project_id="project_id",
32+
app_slug="app_slug",
33+
cfmap_json="cfmap_json",
34+
connect_token="connect_token",
35+
)
36+
```
37+
38+
## Async Client
39+
40+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
41+
42+
```python
43+
import asyncio
44+
45+
from pipedream import AsyncPipedream
46+
47+
client = AsyncPipedream(
48+
x_pd_environment="YOUR_X_PD_ENVIRONMENT",
49+
client_id="YOUR_CLIENT_ID",
50+
client_secret="YOUR_CLIENT_SECRET",
51+
)
52+
53+
54+
async def main() -> None:
55+
await client.accounts.create(
56+
project_id="project_id",
57+
app_slug="app_slug",
58+
cfmap_json="cfmap_json",
59+
connect_token="connect_token",
60+
)
61+
62+
63+
asyncio.run(main())
64+
```
65+
66+
## Exception Handling
67+
68+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
69+
will be thrown.
70+
71+
```python
72+
from pipedream.core.api_error import ApiError
73+
74+
try:
75+
client.accounts.create(...)
76+
except ApiError as e:
77+
print(e.status_code)
78+
print(e.body)
79+
```
80+
81+
## Pagination
82+
83+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.
84+
85+
```python
86+
from pipedream import Pipedream
87+
88+
client = Pipedream(
89+
x_pd_environment="YOUR_X_PD_ENVIRONMENT",
90+
client_id="YOUR_CLIENT_ID",
91+
client_secret="YOUR_CLIENT_SECRET",
92+
)
93+
response = client.apps.list()
94+
for item in response:
95+
yield item
96+
# alternatively, you can paginate page-by-page
97+
for page in response.iter_pages():
98+
yield page
99+
```
100+
101+
## Advanced
102+
103+
### Access Raw Response Data
104+
105+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
106+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
107+
108+
```python
109+
from pipedream import Pipedream
110+
111+
client = Pipedream(
112+
...,
113+
)
114+
response = client.accounts.with_raw_response.create(...)
115+
print(response.headers) # access the response headers
116+
print(response.data) # access the underlying object
117+
pager = client.apps.list(...)
118+
print(pager.response.headers) # access the response headers for the first page
119+
for item in pager:
120+
print(item) # access the underlying object(s)
121+
for page in pager.iter_pages():
122+
print(page.response.headers) # access the response headers for each page
123+
for item in page:
124+
print(item) # access the underlying object(s)
125+
```
126+
127+
### Retries
128+
129+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
130+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
131+
retry limit (default: 2).
132+
133+
A request is deemed retryable when any of the following HTTP status codes is returned:
134+
135+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
136+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
137+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
138+
139+
Use the `max_retries` request option to configure this behavior.
140+
141+
```python
142+
client.accounts.create(..., request_options={
143+
"max_retries": 1
144+
})
145+
```
146+
147+
### Timeouts
148+
149+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
150+
151+
```python
152+
153+
from pipedream import Pipedream
154+
155+
client = Pipedream(
156+
...,
157+
timeout=20.0,
158+
)
159+
160+
161+
# Override timeout for a specific method
162+
client.accounts.create(..., request_options={
163+
"timeout_in_seconds": 1
164+
})
165+
```
166+
167+
### Custom Client
168+
169+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
170+
and transports.
171+
172+
```python
173+
import httpx
174+
from pipedream import Pipedream
175+
176+
client = Pipedream(
177+
...,
178+
httpx_client=httpx.Client(
179+
proxies="http://my.test.proxy.example.com",
180+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
181+
),
182+
)
183+
```
184+
185+
## Contributing
186+
187+
While we value open-source contributions to this SDK, this library is generated programmatically.
188+
Additions made directly to this library would have to be moved over to our generation code,
189+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
190+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
191+
an issue first to discuss with us!
192+
193+
On the other hand, contributions to the README are always very welcome!

0 commit comments

Comments
 (0)