Method Not Allowed The method is not allowed for the requested URl showing error











up vote
0
down vote

favorite












Following code trying to upload json data into MySQL database but showing error like "Method Not Allowed The method is not allowed for the requested URL." Not uploaded json data into MySQL dabase. Please help me what exact problem in my code. I'm new user using flask. After run code I got above error.



    from __future__ import print_function
from flask import Flask, request, jsonify, render_template
from werkzeug import secure_filename
from flask_cors import CORS
from random import randint
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
import MySQLdb
import json
a= [{"JD_Name": "Data Engineer","ID":10,"No_of_Position":5,"Skill_Sets":"Big Data, Python, Hadoop, MapReduce", "Created_Date":"2018-06-30","Received_profile":25,"Interview_completed":4,"Yet_to_schedule":10,
"Attachments":"https://s1.amazon.com/jd-upload/DataJD.docx"}]

app = flask.Flask(__name__)
CORS(app)
app.config["DEBUG"] = True

# do validation and checks before insert
def validate_string(val):
if val != None:
if type(val) is int:
#for x in val:
# print(x)
return str(val).encode('utf-8')
else:
return val

@app.route("/uploaddata", methods=['POST'])
def upload_file():
db = MySQLdb.connect("localhost", "root", "Mysql1!","test")
cur = db.cursor()
for i, item in enumerate(a):
JD_Name= validate_string(item.get("JD_Name", None))
ID= validate_string(item.get("ID", None))
No_of_Position= validate_string(item.get("No_of_Position", None))
Skill_Sets= validate_string(item.get("Skill_Sets", None))
Created_Date= validate_string(item.get("Created_Date", None))
Received_profile= validate_string(item.get("Received_profile", None))
Interview_completed= validate_string(item.get("Interview_completed", None))
Yet_to_schedule= validate_string(item.get("Yet_to_schedule", None))
Attachments= validate_string(item.get("Attachments", None))

cursor.execute("INSERT INTO addjd1 (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments))
con.commit()
con.close()
return 'file uploaded successfully'

app.run()









share|improve this question









New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
    – Daniel Roseman
    23 hours ago










  • Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
    – arsho
    23 hours ago












  • Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
    – Poonam K
    3 hours ago















up vote
0
down vote

favorite












Following code trying to upload json data into MySQL database but showing error like "Method Not Allowed The method is not allowed for the requested URL." Not uploaded json data into MySQL dabase. Please help me what exact problem in my code. I'm new user using flask. After run code I got above error.



    from __future__ import print_function
from flask import Flask, request, jsonify, render_template
from werkzeug import secure_filename
from flask_cors import CORS
from random import randint
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
import MySQLdb
import json
a= [{"JD_Name": "Data Engineer","ID":10,"No_of_Position":5,"Skill_Sets":"Big Data, Python, Hadoop, MapReduce", "Created_Date":"2018-06-30","Received_profile":25,"Interview_completed":4,"Yet_to_schedule":10,
"Attachments":"https://s1.amazon.com/jd-upload/DataJD.docx"}]

app = flask.Flask(__name__)
CORS(app)
app.config["DEBUG"] = True

# do validation and checks before insert
def validate_string(val):
if val != None:
if type(val) is int:
#for x in val:
# print(x)
return str(val).encode('utf-8')
else:
return val

@app.route("/uploaddata", methods=['POST'])
def upload_file():
db = MySQLdb.connect("localhost", "root", "Mysql1!","test")
cur = db.cursor()
for i, item in enumerate(a):
JD_Name= validate_string(item.get("JD_Name", None))
ID= validate_string(item.get("ID", None))
No_of_Position= validate_string(item.get("No_of_Position", None))
Skill_Sets= validate_string(item.get("Skill_Sets", None))
Created_Date= validate_string(item.get("Created_Date", None))
Received_profile= validate_string(item.get("Received_profile", None))
Interview_completed= validate_string(item.get("Interview_completed", None))
Yet_to_schedule= validate_string(item.get("Yet_to_schedule", None))
Attachments= validate_string(item.get("Attachments", None))

cursor.execute("INSERT INTO addjd1 (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments))
con.commit()
con.close()
return 'file uploaded successfully'

app.run()









share|improve this question









New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
    – Daniel Roseman
    23 hours ago










  • Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
    – arsho
    23 hours ago












  • Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
    – Poonam K
    3 hours ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Following code trying to upload json data into MySQL database but showing error like "Method Not Allowed The method is not allowed for the requested URL." Not uploaded json data into MySQL dabase. Please help me what exact problem in my code. I'm new user using flask. After run code I got above error.



    from __future__ import print_function
from flask import Flask, request, jsonify, render_template
from werkzeug import secure_filename
from flask_cors import CORS
from random import randint
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
import MySQLdb
import json
a= [{"JD_Name": "Data Engineer","ID":10,"No_of_Position":5,"Skill_Sets":"Big Data, Python, Hadoop, MapReduce", "Created_Date":"2018-06-30","Received_profile":25,"Interview_completed":4,"Yet_to_schedule":10,
"Attachments":"https://s1.amazon.com/jd-upload/DataJD.docx"}]

app = flask.Flask(__name__)
CORS(app)
app.config["DEBUG"] = True

# do validation and checks before insert
def validate_string(val):
if val != None:
if type(val) is int:
#for x in val:
# print(x)
return str(val).encode('utf-8')
else:
return val

@app.route("/uploaddata", methods=['POST'])
def upload_file():
db = MySQLdb.connect("localhost", "root", "Mysql1!","test")
cur = db.cursor()
for i, item in enumerate(a):
JD_Name= validate_string(item.get("JD_Name", None))
ID= validate_string(item.get("ID", None))
No_of_Position= validate_string(item.get("No_of_Position", None))
Skill_Sets= validate_string(item.get("Skill_Sets", None))
Created_Date= validate_string(item.get("Created_Date", None))
Received_profile= validate_string(item.get("Received_profile", None))
Interview_completed= validate_string(item.get("Interview_completed", None))
Yet_to_schedule= validate_string(item.get("Yet_to_schedule", None))
Attachments= validate_string(item.get("Attachments", None))

cursor.execute("INSERT INTO addjd1 (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments))
con.commit()
con.close()
return 'file uploaded successfully'

app.run()









share|improve this question









New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Following code trying to upload json data into MySQL database but showing error like "Method Not Allowed The method is not allowed for the requested URL." Not uploaded json data into MySQL dabase. Please help me what exact problem in my code. I'm new user using flask. After run code I got above error.



    from __future__ import print_function
from flask import Flask, request, jsonify, render_template
from werkzeug import secure_filename
from flask_cors import CORS
from random import randint
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
import MySQLdb
import json
a= [{"JD_Name": "Data Engineer","ID":10,"No_of_Position":5,"Skill_Sets":"Big Data, Python, Hadoop, MapReduce", "Created_Date":"2018-06-30","Received_profile":25,"Interview_completed":4,"Yet_to_schedule":10,
"Attachments":"https://s1.amazon.com/jd-upload/DataJD.docx"}]

app = flask.Flask(__name__)
CORS(app)
app.config["DEBUG"] = True

# do validation and checks before insert
def validate_string(val):
if val != None:
if type(val) is int:
#for x in val:
# print(x)
return str(val).encode('utf-8')
else:
return val

@app.route("/uploaddata", methods=['POST'])
def upload_file():
db = MySQLdb.connect("localhost", "root", "Mysql1!","test")
cur = db.cursor()
for i, item in enumerate(a):
JD_Name= validate_string(item.get("JD_Name", None))
ID= validate_string(item.get("ID", None))
No_of_Position= validate_string(item.get("No_of_Position", None))
Skill_Sets= validate_string(item.get("Skill_Sets", None))
Created_Date= validate_string(item.get("Created_Date", None))
Received_profile= validate_string(item.get("Received_profile", None))
Interview_completed= validate_string(item.get("Interview_completed", None))
Yet_to_schedule= validate_string(item.get("Yet_to_schedule", None))
Attachments= validate_string(item.get("Attachments", None))

cursor.execute("INSERT INTO addjd1 (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", (JD_Name, ID, No_of_Position, Skill_Sets, Created_Date, Received_profile, Interview_completed, Yet_to_schedule, Attachments))
con.commit()
con.close()
return 'file uploaded successfully'

app.run()






python mysql flask






share|improve this question









New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday





















New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Poonam K

11




11




New contributor




Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Poonam K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
    – Daniel Roseman
    23 hours ago










  • Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
    – arsho
    23 hours ago












  • Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
    – Poonam K
    3 hours ago


















  • This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
    – Daniel Roseman
    23 hours ago










  • Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
    – arsho
    23 hours ago












  • Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
    – Poonam K
    3 hours ago
















This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
– Daniel Roseman
23 hours ago




This doesn't seem to have anything to do with mysql, but with your Flask route. How did you call it? Did you actually make a POST request?
– Daniel Roseman
23 hours ago












Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
– arsho
23 hours ago






Welcome to Stackoverflow. If you try to browse /uploaddata it performs a GET request which is not listed in methods list. A POST request can be perform by adding /uploaddata in a form action's attribute.
– arsho
23 hours ago














Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
– Poonam K
3 hours ago




Thanks Daniel and Arsho for looking this query. I solved this problem used a GET request.
– Poonam K
3 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Poonam K is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372155%2fmethod-not-allowed-the-method-is-not-allowed-for-the-requested-url-showing-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Poonam K is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Poonam K is a new contributor. Be nice, and check out our Code of Conduct.













Poonam K is a new contributor. Be nice, and check out our Code of Conduct.












Poonam K is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372155%2fmethod-not-allowed-the-method-is-not-allowed-for-the-requested-url-showing-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]