cloudflare / cloudflare/cloudflare-python

`script_upload.py` example: Returns `cloudflare.APIStatusError`

Đang mở
#2,657 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
506
Fork
148
Merge trung bình
3 giờ 15 phút
Pull request đã merge (30 ngày)
1

Mô tả

### Confirm this is a Python library issue and not an underlying Cloudflare API issue.

- [x] This is an issue with the Python library

### Describe the bug

When running the `script_upload.py` script, I get:

```
cloudflare.APIStatusError: Error code: 415 - {'result': None, 'success': False, 'errors': [{'code': 10001, 'message': 'Content-Type must be one of: application/javascript, text/javascript, multipart/form-data'}], 'messages': []}
```

This indicates to problems:

1. The `except` block should expect an exception of type `APIStatusError`, not `BadRequestError`
2. The `tuple` to upload the files is buggy

### To Reproduce

Run
```bash
CLOUDFLARE_API_TOKEN="..." CLOUDFLARE_ACCOUNT_ID="..." uv run script_upload.py
```

### Code snippets

```Python

```

### OS

macOS

### Python version

3.13

### Library version

4.2.0

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.