Answer to Question #253577 in Python for Yami

Question #253577

#How to run this server #Use the datetime classes to create, extractt and munipulate dates and times.

from datetime import datetime

#Use json to format your response

import json

#import the requests library to be able to SEND request

import requests

#From the flask library, import only the Flask, request ad Response classes.

#the request class (not the same as the requests library) is used to to used to recieve requests

#if you have to convert several objects as one nested json structure, you cannot use flask,jsonify.

app = Flask(__name__)

CORS(app)

@app.route("/", method = ["POST"]) # Run this method when receiving any POST request

@cross_origin(origin='*') #Allow requests from any domain

def myMainFunction():

...


1
Expert's answer
2021-10-20T00:54:41-0400
from datetime import datetime
import json
import requests
from flask import Flask, request , Response


app = Flask(__name__)


CORS(app)


@app.route("/", method = ["POST"]) # Run this method when receiving any POST request


@cross_origin(origin='*') #Allow requests from any domain


def myMainFunction():
    datetime_object = datetime.now()
    print(datetime_object)
    print('Type :- ',type(datetime_object))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS