Skip to content

script_upload.py example: Returns cloudflare.APIStatusError #2657

Open

Description

@sebst

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

Activity

  1. jhutchings1 commented on Jun 30, 2025

    @jhutchings1
    Collaborator

    @sebst Can you confirm that the script you are uploading is in fact in one of the supported media types? Trying to figure out where the issue lies. Thanks!

  2. sebst commented on Jul 11, 2025

    @sebst
    Author

    @sebst Can you confirm that the script you are uploading is in fact in one of the supported media types? Trying to figure out where the issue lies. Thanks!

    I tried to figure that out. In fact, I really just tried to run https://github.com/cloudflare/cloudflare-python/blob/main/examples/workers/script_upload.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions