Lib for adding file upload functionality to GraphQL mutations in Graphene Django
Project description
graphene-file-upload is a drop in replacement for the the GraphQL view in Graphene for Django. It supports multi-part file uploads that adhere to the Multipart Request Spec (https://github.com/jaydenseric/graphql-multipart-request-spec).
Installation:
pip install graphene-file-upload
Usage:
To use, import the view, then add to your list of urls (replace previous GraphQL view).
from graphene_file_upload import ModifiedGraphQLView urlpatterns = [ url(r'^graphql', ModifiedGraphQLView.as_view(graphiql=True)), ]
To add an upload type to your mutation, import and use Upload. Upload is a scalar type.
from graphene_file_upload import Upload
class UploadMutation(graphene.Mutation):
class Arguments:
file = Upload(required=True)
success = graphene.Boolean()
def mutate(self, info, file, **kwargs):
# file parameter is key to uploaded file in FILES from context
uploaded_file = info.context.FILES.get(file)
# do something with your file
return UploadMutation(success=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphene_file_upload-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: graphene_file_upload-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47bc766634235af66f8da06b34512239817ace6f581f764cd5ea6da8edd778ef
|
|
| MD5 |
6fbe31f741bbfcc8d8268996ab8adaab
|
|
| BLAKE2b-256 |
8134b579201d559914c341e094628f9e88c911af61e1f2b868975de42aebe093
|