Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File uploading endpoint added #3867

Merged
merged 4 commits into from
Jun 27, 2017
Merged

Conversation

SaptakS
Copy link
Contributor

@SaptakS SaptakS commented Jun 24, 2017

Fixes #

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes

#3738

@codecov
Copy link

codecov bot commented Jun 24, 2017

Codecov Report

Merging #3867 into nextgen will decrease coverage by 0.24%.
The diff coverage is 25.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           nextgen   #3867      +/-   ##
==========================================
- Coverage    54.54%   54.3%   -0.25%     
==========================================
  Files          133     133              
  Lines         7953    7992      +39     
==========================================
+ Hits          4338    4340       +2     
- Misses        3615    3652      +37
Impacted Files Coverage Δ
app/__init__.py 88.37% <100%> (ø) ⬆️
app/api/helpers/files.py 18.91% <18.91%> (ø)
app/api/uploads.py 30.55% <30.55%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 811f507...2220c86. Read the comment docs.

@SaptakS SaptakS changed the title Single File upload added File uploading endpoint added Jun 26, 2017
from flask import Blueprint
from flask import url_for, make_response, request, current_app, jsonify, abort
from flask_jwt import jwt_required
from flask import current_app as app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'flask.current_app as app' imported but unused

@@ -0,0 +1,69 @@
from flask import Blueprint
from flask import url_for, make_response, request, current_app, jsonify, abort

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'flask.url_for' imported but unused
'flask.current_app' imported but unused


+ Request(multipart/form-data; boundary=---BOUNDARY)

-----BOUNDARY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add sample data too. Blueprint should have a full sample request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niranjan94 as far as I saw in examples of API Blueprint of files, if the data is in the form of base64encoded image or any other hash, then data is also included. Else, it is shown like this. One of the links I referred is this. See the CSV file upload in the example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm ... okay

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything else?

return jsonify({"url": image_url})


@upload_routes.route('/file', methods=['POST'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets call it files by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I saw the issue description and did accordingly. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved.

@SaptakS SaptakS force-pushed the file-upload branch 2 times, most recently from 145a3ce to c61dad8 Compare June 27, 2017 10:36
@magdalenesuo magdalenesuo merged commit 79ae4a8 into fossasia:nextgen Jun 27, 2017
@SaptakS SaptakS mentioned this pull request Jul 8, 2017
6 tasks
@open-event-bot open-event-bot bot added the has-PR label Jul 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants