-
Notifications
You must be signed in to change notification settings - Fork 2
added backend endpoint #301
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
Open
HimanshuRanka
wants to merge
1
commit into
master
Choose a base branch
from
himanshu/google-append-values
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .google_spreadsheet_controller import google_spreadsheet_ns |
25 changes: 25 additions & 0 deletions
25
app/namespaces/google_spreadsheet/google_spreadsheet_controller.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from flask import request | ||
| from flask_restplus import Resource, Namespace | ||
|
|
||
| from app.database_etl.tableau_data_connector.google_services_manager import GoogleSheetsManager | ||
|
|
||
| google_spreadsheet_ns = Namespace('google_spreadsheet', description='Endpoints for making changes to google sheets') | ||
|
|
||
|
|
||
| @google_spreadsheet_ns.route("/newsletter", methods=["POST"]) | ||
| class AppendNewsletterSignup(Resource): | ||
| @google_spreadsheet_ns.doc("An endpoint for adding new newslettter signups to the newsletter spreadsheet") | ||
| def post(self): | ||
| data = request.get_json() | ||
| if not data: | ||
| return {"message": "No input payload provided"}, 400 | ||
|
|
||
| sheet_name = "Sheet1" | ||
| spreadsheet_id = "" | ||
| range_name = "!A1:B1" | ||
| values = data.get("values") | ||
|
|
||
| g_client = GoogleSheetsManager(sheet_name) | ||
| g_client.append_sheet(spreadsheet_id=spreadsheet_id, range_name=range_name, values=values) | ||
|
|
||
| return {"Message": "Added email to spreadsheet"}, 200 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,14 +69,6 @@ Jinja2~=2.11.2 | |
| jmespath~=0.10.0 | ||
| json5~=0.9.5 | ||
| jsonschema~=3.2.0 | ||
| jupyter-client~=6.1.11 | ||
| jupyter-core~=4.7.1 | ||
| jupyter-packaging~=0.9.2 | ||
| jupyter-server~=1.6.4 | ||
| jupyterlab~=3.0.14 | ||
| jupyterlab-pygments~=0.1.2 | ||
| jupyterlab-server~=2.5.0 | ||
| jupyterlab-widgets~=1.0.0 | ||
|
Comment on lines
-72
to
-79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saw your message about removing this diff but I thought I would just add a reminder :) |
||
| keyring~=23.0.1 | ||
| kiwisolver~=1.3.1 | ||
| lerc~=0.1.0 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NP: Will we eventually move this to a constants file or .env? I know these are testing values but might be cleaner to keep them somewhere where we store constants.