Comments (7)
def mutate(cls, info, **kwargs):
file = info.context.files.get('file', None)
from flask-graphql.
@michaelkuty can you make it work with Apollo? I got "Must provide query string." error when trying to send multipart/form-data;
to the server.
from flask-graphql.
In apollo you must use something like middleware or something else..
from flask-graphql.
hm, have you actually worked on it? I'm using https://github.com/jaydenseric/apollo-upload-client
for a client that sends multipart/form-data
to the server but it seems not working.
from flask-graphql.
Ok, just managed to get it to work with Apollo. The problem lies with incorrect handling of the multipart-encoded request, here: https://github.com/graphql-python/flask-graphql/blob/master/flask_graphql/graphqlview.py#L126-L127
I sub-classed the GraphQLView to properly handle multipart/form-data
, as per the spec. I also created a custom scalar field that can be used for file uploads, so no need to get files out of info.context
or flask.request
.
https://gist.github.com/rshk/97fd7b444e48c60218addb2b64897572
This will work with the version of flask-graphql
currently in pypi; I haven't tested whith the master
version yet (but should still work).
I can open a PR with the changes (I have unit tests covering that place_files_in_operations
too).
from flask-graphql.
Similar to https://github.com/lmcgartland/graphene-file-upload/blob/master/graphene_file_upload/__init__.py
We can change a few things like I mentioned in lmcgartland/graphene-file-upload#3 to make it work for Flask.
from flask-graphql.
See #51
from flask-graphql.
Related Issues (20)
- How to get GraphQL error objects using GraphQLView in 2.0.0? HOT 1
- No updates recently? HOT 1
- Why graphql does not return JSON?
- Incompatible with graphql-core==3.0.0 HOT 2
- Upgrade to graphql-core v3 HOT 3
- Enabling "explorer" HOT 14
- Bump graphql-core version to fix concurrency / security issues
- Flask-GraphQL now returns warnings when using `graphql-core HOT 3
- Include Altair GraphQL view HOT 2
- The embedded GraphiQL version is extremely outdated HOT 5
- Documentation on how to make an update mutation
- Header support in graphiQL interface HOT 9
- AttributeError on Graphqlview HOT 1
- CSRF Exemption? HOT 1
- which graphiql version is using? HOT 2
- Accessing query/mutation name from GraphQLView
- Graphene v3 breaks flask-graphql HOT 1
- Dependency conflicts with graphene>=3.0 HOT 2
- python 3.10+ MutableMapping ImportError HOT 1
- Error when importing flask_graphql HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-graphql.