Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 3.0.0-beta.9 #362

Merged
merged 120 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
e7b1250
feat(api): OpenAPI spec update via Stainless API (#361)
stainless-app[bot] Apr 24, 2024
3e13206
feat(api): OpenAPI spec update via Stainless API (#363)
stainless-app[bot] Apr 24, 2024
f07a5ed
feat(api): OpenAPI spec update via Stainless API (#364)
stainless-app[bot] Apr 24, 2024
14b7e5f
feat(api): update via SDK Studio (#365)
stainless-app[bot] Apr 25, 2024
450bcb1
feat(api): OpenAPI spec update via Stainless API (#366)
stainless-app[bot] Apr 26, 2024
667ea29
feat(api): OpenAPI spec update via Stainless API (#367)
stainless-app[bot] Apr 26, 2024
0f6894c
feat(api): OpenAPI spec update via Stainless API (#368)
stainless-app[bot] Apr 26, 2024
f4bc07d
feat(api): OpenAPI spec update via Stainless API (#369)
stainless-app[bot] Apr 26, 2024
4462926
feat(api): OpenAPI spec update via Stainless API (#370)
stainless-app[bot] Apr 27, 2024
62735a6
feat(api): OpenAPI spec update via Stainless API (#371)
stainless-app[bot] Apr 27, 2024
8c8ac04
feat(api): update via SDK Studio (#372)
stainless-app[bot] Apr 29, 2024
901076d
feat(api): OpenAPI spec update via Stainless API (#373)
stainless-app[bot] Apr 29, 2024
4c264e5
feat(api): OpenAPI spec update via Stainless API (#374)
stainless-app[bot] Apr 29, 2024
f47b44d
feat(api): OpenAPI spec update via Stainless API (#375)
stainless-app[bot] Apr 29, 2024
2b05694
feat(api): OpenAPI spec update via Stainless API (#376)
stainless-app[bot] Apr 29, 2024
0d9658b
feat(api): OpenAPI spec update via Stainless API (#377)
stainless-app[bot] Apr 29, 2024
1e6baac
feat(api): OpenAPI spec update via Stainless API (#378)
stainless-app[bot] Apr 29, 2024
50890de
feat(api): OpenAPI spec update via Stainless API (#379)
stainless-app[bot] Apr 29, 2024
3791b11
feat(api): OpenAPI spec update via Stainless API (#380)
stainless-app[bot] Apr 29, 2024
1b02ff2
feat(api): OpenAPI spec update via Stainless API (#381)
stainless-app[bot] Apr 29, 2024
271a315
feat(api): update via SDK Studio (#382)
stainless-app[bot] Apr 29, 2024
bcfd50b
feat(api): OpenAPI spec update via Stainless API (#383)
stainless-app[bot] Apr 30, 2024
95d2093
feat(api): OpenAPI spec update via Stainless API (#384)
stainless-app[bot] Apr 30, 2024
e879c41
feat(api): OpenAPI spec update via Stainless API (#385)
stainless-app[bot] Apr 30, 2024
4131fb9
feat(api): OpenAPI spec update via Stainless API (#386)
stainless-app[bot] Apr 30, 2024
0c45514
feat(api): OpenAPI spec update via Stainless API (#387)
stainless-app[bot] Apr 30, 2024
f0d079b
feat(api): OpenAPI spec update via Stainless API (#388)
stainless-app[bot] Apr 30, 2024
d480ff6
feat(api): OpenAPI spec update via Stainless API (#389)
stainless-app[bot] Apr 30, 2024
e9cf58d
feat(api): OpenAPI spec update via Stainless API (#390)
stainless-app[bot] Apr 30, 2024
4f7262f
feat(api): OpenAPI spec update via Stainless API (#391)
stainless-app[bot] Apr 30, 2024
6f6d0ee
feat(api): OpenAPI spec update via Stainless API (#392)
stainless-app[bot] Apr 30, 2024
ed813ec
feat(api): OpenAPI spec update via Stainless API (#393)
stainless-app[bot] Apr 30, 2024
4f2b676
feat(api): OpenAPI spec update via Stainless API (#394)
stainless-app[bot] Apr 30, 2024
748f5f6
feat(api): OpenAPI spec update via Stainless API (#395)
stainless-app[bot] Apr 30, 2024
e491374
feat(api): OpenAPI spec update via Stainless API (#396)
stainless-app[bot] Apr 30, 2024
d78d4fd
feat(api): OpenAPI spec update via Stainless API (#397)
stainless-app[bot] Apr 30, 2024
922ae56
feat(api): OpenAPI spec update via Stainless API (#398)
stainless-app[bot] Apr 30, 2024
6f51237
feat(api): OpenAPI spec update via Stainless API (#399)
stainless-app[bot] Apr 30, 2024
93768ad
feat(api): OpenAPI spec update via Stainless API (#400)
stainless-app[bot] Apr 30, 2024
4f30fd4
chore: rebuild project due to oas spec rename (#401)
stainless-app[bot] Apr 30, 2024
9d3553e
feat(api): OpenAPI spec update via Stainless API (#402)
stainless-app[bot] Apr 30, 2024
c6b3d39
feat(api): update via SDK Studio (#403)
stainless-app[bot] May 1, 2024
43518fe
feat(api): OpenAPI spec update via Stainless API (#404)
stainless-app[bot] May 1, 2024
c63ecd2
feat(api): OpenAPI spec update via Stainless API (#405)
stainless-app[bot] May 1, 2024
440ed8c
feat(api): OpenAPI spec update via Stainless API (#406)
stainless-app[bot] May 1, 2024
d710762
feat(api): OpenAPI spec update via Stainless API (#407)
stainless-app[bot] May 1, 2024
f4b5236
feat(api): OpenAPI spec update via Stainless API (#408)
stainless-app[bot] May 1, 2024
61d3efb
feat(api): update via SDK Studio (#409)
stainless-app[bot] May 1, 2024
0bdab77
feat(api): OpenAPI spec update via Stainless API (#410)
stainless-app[bot] May 1, 2024
cc69543
feat(api): OpenAPI spec update via Stainless API (#411)
stainless-app[bot] May 1, 2024
bf03c16
feat(api): OpenAPI spec update via Stainless API (#412)
stainless-app[bot] May 1, 2024
0573515
feat(api): OpenAPI spec update via Stainless API (#413)
stainless-app[bot] May 1, 2024
163b0c6
feat(api): OpenAPI spec update via Stainless API (#414)
stainless-app[bot] May 1, 2024
2c56c7a
feat(api): OpenAPI spec update via Stainless API (#415)
stainless-app[bot] May 2, 2024
04a6d48
feat(api): OpenAPI spec update via Stainless API (#416)
stainless-app[bot] May 2, 2024
9312532
feat(api): update via SDK Studio (#417)
stainless-app[bot] May 2, 2024
068cc21
feat(api): OpenAPI spec update via Stainless API (#418)
stainless-app[bot] May 2, 2024
2817348
feat(api): update via SDK Studio (#419)
stainless-app[bot] May 2, 2024
e62e98e
feat(api): OpenAPI spec update via Stainless API (#420)
stainless-app[bot] May 2, 2024
d81b910
feat(api): OpenAPI spec update via Stainless API (#421)
stainless-app[bot] May 2, 2024
251ecc8
feat(api): OpenAPI spec update via Stainless API (#422)
stainless-app[bot] May 2, 2024
8d41200
feat(api): OpenAPI spec update via Stainless API (#423)
stainless-app[bot] May 2, 2024
b642c09
feat(api): OpenAPI spec update via Stainless API (#424)
stainless-app[bot] May 2, 2024
82d2f8f
feat(api): OpenAPI spec update via Stainless API (#425)
stainless-app[bot] May 2, 2024
aeb756c
feat(api): OpenAPI spec update via Stainless API (#426)
stainless-app[bot] May 2, 2024
36dc827
feat(api): OpenAPI spec update via Stainless API (#427)
stainless-app[bot] May 2, 2024
745d056
feat(api): OpenAPI spec update via Stainless API (#428)
stainless-app[bot] May 2, 2024
d819bba
feat(api): OpenAPI spec update via Stainless API (#429)
stainless-app[bot] May 2, 2024
b40922a
feat(api): OpenAPI spec update via Stainless API (#430)
stainless-app[bot] May 2, 2024
4c49e97
feat(api): OpenAPI spec update via Stainless API (#431)
stainless-app[bot] May 2, 2024
f6889f6
feat(api): OpenAPI spec update via Stainless API (#432)
stainless-app[bot] May 2, 2024
e7fbd5c
feat(api): OpenAPI spec update via Stainless API (#433)
stainless-app[bot] May 2, 2024
44790eb
feat(api): OpenAPI spec update via Stainless API (#434)
stainless-app[bot] May 2, 2024
2515c7d
feat(api): OpenAPI spec update via Stainless API (#435)
stainless-app[bot] May 2, 2024
00ce34a
feat(api): OpenAPI spec update via Stainless API (#436)
stainless-app[bot] May 2, 2024
c785026
feat(api): OpenAPI spec update via Stainless API (#437)
stainless-app[bot] May 2, 2024
380ae03
feat(api): OpenAPI spec update via Stainless API (#438)
stainless-app[bot] May 2, 2024
32602b7
feat(api): OpenAPI spec update via Stainless API (#439)
stainless-app[bot] May 2, 2024
3f60ca4
feat(api): OpenAPI spec update via Stainless API (#440)
stainless-app[bot] May 2, 2024
4b0f6de
feat(api): OpenAPI spec update via Stainless API (#441)
stainless-app[bot] May 2, 2024
9bc4051
feat(api): OpenAPI spec update via Stainless API (#442)
stainless-app[bot] May 2, 2024
960003f
feat(api): OpenAPI spec update via Stainless API (#443)
stainless-app[bot] May 2, 2024
b599852
feat(api): OpenAPI spec update via Stainless API (#444)
stainless-app[bot] May 2, 2024
7dcadc3
feat(api): OpenAPI spec update via Stainless API (#445)
stainless-app[bot] May 2, 2024
b576950
feat(api): OpenAPI spec update via Stainless API (#446)
stainless-app[bot] May 2, 2024
9920201
feat(api): OpenAPI spec update via Stainless API (#447)
stainless-app[bot] May 2, 2024
38532c0
feat(api): OpenAPI spec update via Stainless API (#448)
stainless-app[bot] May 2, 2024
91c6d1e
feat(api): OpenAPI spec update via Stainless API (#449)
stainless-app[bot] May 3, 2024
16afaf2
feat(api): OpenAPI spec update via Stainless API (#450)
stainless-app[bot] May 3, 2024
7522679
feat(api): OpenAPI spec update via Stainless API (#451)
stainless-app[bot] May 3, 2024
3947c44
feat(api): OpenAPI spec update via Stainless API (#452)
stainless-app[bot] May 3, 2024
52e20a3
feat(api): OpenAPI spec update via Stainless API (#453)
stainless-app[bot] May 3, 2024
181cc9b
feat(api): OpenAPI spec update via Stainless API (#454)
stainless-app[bot] May 4, 2024
64acf4e
feat(api): OpenAPI spec update via Stainless API (#455)
stainless-app[bot] May 4, 2024
cc6768e
feat(api): update via SDK Studio (#456)
stainless-app[bot] May 6, 2024
8b0e168
feat(api): OpenAPI spec update via Stainless API (#457)
stainless-app[bot] May 6, 2024
6f64262
feat(api): OpenAPI spec update via Stainless API (#458)
stainless-app[bot] May 6, 2024
89bb6c5
feat(api): update via SDK Studio (#459)
stainless-app[bot] May 6, 2024
32e92cf
feat(api): OpenAPI spec update via Stainless API (#460)
stainless-app[bot] May 6, 2024
16dd159
feat(api): OpenAPI spec update via Stainless API (#461)
stainless-app[bot] May 6, 2024
f1ce7a5
feat(api): OpenAPI spec update via Stainless API (#462)
stainless-app[bot] May 6, 2024
2cb4efb
feat(api): OpenAPI spec update via Stainless API (#463)
stainless-app[bot] May 6, 2024
7892bb7
feat(api): OpenAPI spec update via Stainless API (#464)
stainless-app[bot] May 6, 2024
a7900a2
feat(api): update via SDK Studio (#465)
stainless-app[bot] May 7, 2024
8f7435e
feat(api): update via SDK Studio (#466)
stainless-app[bot] May 7, 2024
bce1bf4
feat(api): update via SDK Studio (#467)
stainless-app[bot] May 7, 2024
a6c4b4b
feat(api): update via SDK Studio (#468)
stainless-app[bot] May 7, 2024
37db74d
feat(api): update via SDK Studio (#469)
stainless-app[bot] May 7, 2024
6b8c3c3
feat(api): update via SDK Studio (#470)
stainless-app[bot] May 7, 2024
7fc60d8
feat(api): update via SDK Studio (#471)
stainless-app[bot] May 7, 2024
b8e303b
feat(api): update via SDK Studio (#472)
stainless-app[bot] May 7, 2024
535bdb6
feat(api): update via SDK Studio (#473)
stainless-app[bot] May 7, 2024
dbf1fc7
feat(api): update via SDK Studio (#474)
stainless-app[bot] May 7, 2024
52fc220
feat(api): update via SDK Studio (#475)
stainless-app[bot] May 7, 2024
ab74d84
feat(api): update via SDK Studio (#476)
stainless-app[bot] May 7, 2024
2dc376e
feat(api): update via SDK Studio (#477)
stainless-app[bot] May 7, 2024
cbd5196
feat(api): update via SDK Studio (#478)
stainless-app[bot] May 7, 2024
18505d8
feat(api): update via SDK Studio (#479)
stainless-app[bot] May 8, 2024
72ff19a
feat(api): update via SDK Studio (#480)
stainless-app[bot] May 8, 2024
9418b4d
release: 3.0.0-beta.9
stainless-app[bot] May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,26 @@ jobs:
- name: Ensure importable
run: |
rye run python -c 'import cloudflare'
test:
name: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Bootstrap
run: ./scripts/bootstrap

- name: Run tests
run: ./scripts/test
examples:
name: examples
runs-on: ubuntu-latest
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@v3
- uses: actions/checkout@v4

- 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 @@ -10,7 +10,7 @@ jobs:
if: github.repository == 'cloudflare/cloudflare-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check release environment
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ dist
.env
.envrc
codegen.log
Brewfile.lock.json
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.0.0-beta.8"
".": "3.0.0-beta.9"
}
3 changes: 2 additions & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
configured_endpoints: 1266
configured_endpoints: 1274
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07ec76fab00de3d6227209faf0af1ed586cde9e2f243c13d3db555da20f13d99.yml
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brew "rye"

130 changes: 130 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ client = Cloudflare(
)

# Override per-request:
client.with_options(timeout=5 * 1000).zones.edit(
client.with_options(timeout=5.0).zones.edit(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
```
Expand Down Expand Up @@ -312,7 +312,7 @@ The context manager is required so that the response will reliably be closed.

### Making custom/undocumented requests

This library is typed for convenient access the documented API.
This library is typed for convenient access to the documented API.

If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Expand Down
515 changes: 289 additions & 226 deletions api.md

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions bin/check-env-state.py

This file was deleted.

50 changes: 0 additions & 50 deletions bin/check-test-server

This file was deleted.

3 changes: 0 additions & 3 deletions bin/test

This file was deleted.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cloudflare"
version = "3.0.0-beta.8"
version = "3.0.0-beta.9"
description = "The official Python library for the cloudflare API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -68,7 +68,7 @@ format = { chain = [
"fix:ruff",
]}
"format:black" = "black ."
"format:docs" = "python bin/ruffen-docs.py README.md api.md"
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:ruff" = "ruff format"
"format:isort" = "isort ."

Expand Down Expand Up @@ -192,5 +192,6 @@ known-first-party = ["cloudflare", "tests"]

[tool.ruff.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
"scripts/**.py" = ["T201", "T203"]
"tests/**.py" = ["T201", "T203"]
"examples/**.py" = ["T201", "T203"]
19 changes: 19 additions & 0 deletions scripts/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi

echo "==> Installing Python dependencies…"

# experimental uv support makes installations significantly faster
rye config --set-bool behavior.use-uv=true

rye sync
8 changes: 8 additions & 0 deletions scripts/format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

rye run format

8 changes: 8 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

rye run lint

41 changes: 41 additions & 0 deletions scripts/mock
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

if [[ -n "$1" && "$1" != '--'* ]]; then
URL="$1"
shift
else
URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
fi

# Check if the URL is empty
if [ -z "$URL" ]; then
echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
exit 1
fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
fi
57 changes: 57 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

# Run tests
echo "==> Running tests"
rye run pytest "$@"
File renamed without changes.
9 changes: 8 additions & 1 deletion src/cloudflare/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ def _request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

try:
response = self._client.send(
request,
Expand Down Expand Up @@ -983,7 +985,12 @@ def _request(
raise APIConnectionError(request=request) from err

log.debug(
'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase
'HTTP Response: %s %s "%i %s" %s',
request.method,
request.url,
response.status_code,
response.reason_phrase,
response.headers,
)

try:
Expand Down
Loading