Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

graphene-file-upload

graphene-file-upload is a drop in replacement for the the GraphQL view in Graphene for Django, and for Flask-Graphql. It supports multi-part file uploads that adhere to the Multipart Request Spec.

Installation:

pip install graphene-file-upload

Usage

To add an upload type to your mutation, import and use Upload. Upload is a scalar type.

from graphene_file_upload.scalars import Upload

class UploadMutation(graphene.Mutation):
    class Arguments:
        file = Upload(required=True)

    success = graphene.Boolean()

    def mutate(self, info, file, **kwargs):
        # do something with your file

        return UploadMutation(success=True)

Django Integration:

To use, import the view, then add to your list of urls (replace previous GraphQL view).

from graphene_file_upload.django import FileUploadGraphQLView

urlpatterns = [
  url(r'^graphql', FileUploadGraphQLView.as_view(graphiql=True)),
]

Flask Integration:

Note that flask-graphql version <2.0 is not supported. At the time of writing this README, you must install flask-graphql with pip install --pre flask-graphql

Simply import the modified view and create a new url rule on your app:

from graphene_file_upload.flask import FileUploadGraphQLView

app.add_url_rule(
    '/graphql',
    view_func=FileUploadGraphQLView.as_view(
      ...
    )
)

Testing:

TO-DO, still need to write tests for Django and Flask views.

Packaging for PyPi:

Build the distribution.

python3 setup.py sdist bdist_wheel

Upload to PyPi test servers.

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Upload to PyPi production servers.

twine upload dist/*

Metadata

Release files for graphene-file-upload 1.0.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphene-file-upload 1.0.0a2
File Size Uploaded Provenance Actions
graphene_file_upload-1.0.0a2.tar.gz 3.4 kB Without provenance Details for graphene_file_upload-1.0.0a2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graphene-file-upload 1.0.0a2
File Interpreter ABI Platform Actions
graphene_file_upload-1.0.0a2-py3-none-any.whl Python 3 none any Details for graphene_file_upload-1.0.0a2-py3-none-any.whl

Total release size: 7.6 kB

Release files / graphene_file_upload-1.0.0a2.tar.gz

Download URL graphene_file_upload-1.0.0a2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
779bfc8aba1f66af0274e1ce28ead3b47d336e5fef94734eb2055ea4cc93ed85
BLAKE2b-256 checksum
How to use checksums
e93bdbe70d8f57a822ba63c47d82e76fed13c9e08d448647b4e1bb34b26dc4d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / graphene_file_upload-1.0.0a2-py3-none-any.whl

Download URL graphene_file_upload-1.0.0a2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3144e66137d66ead4f67e093c63349ca5f5d216e92d8891bdd755a8c0987e504
BLAKE2b-256 checksum
How to use checksums
7454fb85c9e2b88cf372b2e642b11a5cce128d96547126895a302d29181adb74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for graphene-file-upload 1.0.0a2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page