Last active
February 25, 2022 12:40
-
-
Save fernaoguerra/a662c6abe949659a9476433b23e95bf8 to your computer and use it in GitHub Desktop.
CORS function
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
| import mysql.connector | |
| import datetime | |
| import time | |
| from flask import jsonify | |
| def hello_world(request): | |
| """Responds to any HTTP request. | |
| Args: | |
| request (flask.Request): HTTP request object. | |
| Returns: | |
| The response text or any set of values that can be turned into a | |
| Response object using | |
| `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`. | |
| """ | |
| id = request.args.get("id") | |
| request_json = request.get_json() | |
| if request.args and 'message' in request.args: | |
| return request.args.get('message') | |
| elif request_json and 'message' in request_json: | |
| return request_json['message'] | |
| else: | |
| # return f'Hello World!' | |
| return get_experiences(id) | |
| def get_experiences(id): | |
| print("entrou2") | |
| cnx = mysql.connector.connect(user='root', password='password', | |
| host='host', | |
| database='all_data') | |
| cursor = cnx.cursor(dictionary=True) | |
| cursor.execute('select * from linkedin_user_job_experiences where id = "' +id+'" and deleted_at IS NULL') | |
| request = cursor.fetchall() | |
| print(request) | |
| return jsonify(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment