import requests
import json
import pandas as pd
import base64
import time
from bs4 import BeautifulSoup
from datetime import datetime
from calendar import monthrange
def encode_base64(message):
message_bytes = message.encode('ascii')
base64_bytes = base64.b64encode(message_bytes)
base64_message = base64_bytes.decode('ascii')
return base64_message
def decode_base64(base64_message):
base64_bytes = base64_message.encode('ascii')
message_bytes = base64.b64decode(base64_bytes)
message = message_bytes.decode('ascii')
return message
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template('form.html')
@app.route('/', methods=['POST'])
def my_form_post():
startDate = request.form['startDate']
releasedDate = request.form['releasedDate']
versionName = request.form['versionName']
description = request.form['description']
# Meta
Username = decode_base64("aG9hbmdubTMy")
Password = decode_base64("U2tZTCFHaFQxMjM3")
JiraLink = "https://insight.fsoft.com.vn/jira3/"
ProjectID = "56107"
JiraVersionProjectLink = JiraLink + "rest/api/2/project/"+ProjectID+"/versions"
JiraVersionLink = JiraLink + "rest/api/2/version"
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps( {
"archived": False,
"startDate": startDate,
"releaseDate": releasedDate,
"name": "v" + versionName,
"description": description,
"projectId": ProjectID,
"released": False
} )
response = requests.request(
"POST",
JiraVersionLink,
data=payload,
headers=headers,
auth=(Username, Password)
)
return(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
app.run(host='0.0.0.0', port=8080)
Link
https://a5bd3c9d-dd52-40f9-bceb-8a503a31e2ab.deepnoteproject.com