Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#2,657 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Open the script_upload.py example and run it with the documented CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables. Check the exception type handled by the except block and the tuple used to upload the files. Done means the example accepts the reported content types without the 415 error and handles APIStatusError correctly.

Written by the indexing model from the issue text.

Description

Confirm this is a Python library issue and not an underlying Cloudflare API issue.
  • 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

CLOUDFLARE_API_TOKEN="..." CLOUDFLARE_ACCOUNT_ID="..." uv run script_upload.py
Code snippets

OS

macOS

Python version

3.13

Library version

4.2.0

Dominant language
Python
Stars
509
Forks
150
Avg merge
3h 15m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cloudflare-python

All issues in cloudflare/cloudflare-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.