I can not figure out for the life of me why it is showing a Unresolved reference for 'self' after the form_head, form_body, and form_foot bit... which isn't allowing the Google Engine Application to display and run correctly. Any help would be helpful.
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
#web page sections
form_head='''<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>Gamers R' Us Subscribing</title>
</head>
<body>'''
form_body='''
<div class="maincontainer">
<h1>Welcome to Gamers R' Us!</h1>
<div id="bgimg">
<p>Filler atm.</p>
<div id="formbox">
<h2>Subscribe Today!</h2>
<form method="GET">
<label>Full Name: </label><input type="text" name="name" placeholder=" John Doe"/><br>
<label>Email: </label><input type="text" name="email" placeholder=" me#domain.com"/><br>
<select name="system" class="selectbox">
<option value="ps4">Playstation 4</option>
<option value="xbone">Xbox One</option>
<option value="wiiu">Wii U</option>
<option value="pc">PC Gaming</option>
</select><br>
<input type="radio" name="genre" value="FPS">First Person Shooter.<br>
<input type="radio" name="genre" value="MOBA">Multiplayer Online Battle Arena.<br>
<input type="radio" name="genre" value="RPG">Role-Playing Game.<br>
<input type="radio" name="genre" value="RTS">Real Time Strategy.<br>
<input type="radio" name="genre" value="Other">Other Genre.<br>
<input type="checkbox" name="subscribe" value="yes" checked>Subscribe for gaming updates and more!<br>
<input type="submit" class="subbtn" value="Done" />
</form>
</div>
</div>
</div>'''
form_foot='''
</body>
</html>'''
#if GET is requested it should display on next screen.
#else should load page.
if self.request.GET:
name= self.request.GET['name']
email= self.request.GET['email']
system= self.request.GET['system']
genre= self.request.GET['genre']
subscribe= self.request.GET['subscribe']
#displays form information submitted by user.
self.response.write(form_head + "<div class='maincontainer'>" +
'<h1>Thanks for Subbing!</h1>' +
'<div id="infobox">' +
'<h2></h2>' +
"Name: "+name+"<br />" +
"Email: "+email+"<br />" +
"Preferred System: "+system+"<br /> " +
"Preferred Genre: "+genre+
'</div>' +
'</div>' +
form_foot)
#Will display error. ** PLACE HOLDER **
else:
self.response.write("Help! Error!")
# Do not touch this.
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
Here's your code properly indented (as far as I can tell).
I've updated my previous answer to show how to usetextwrap.dedent()to remove excess indentation often required to make large in-lined text blocks mixed with indented code more readable. In addition, I modified the self.response.write() statement near the end to show a cleaner way of substituting multiple text variable values into a longish string.
import textwrap
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
#web page sections
form_head=textwrap.dedent('''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>Gamers R' Us Subscribing</title>
</head>
<body>''')
form_body=textwrap.dedent('''
<div class="maincontainer">
<h1>Welcome to Gamers R' Us!</h1>
<div id="bgimg">
<p>Filler atm.</p>
<div id="formbox">
<h2>Subscribe Today!</h2>
<form method="GET">
<label>Full Name: </label><input type="text" name="name" placeholder=" John Doe"/><br>
<label>Email: </label><input type="text" name="email" placeholder=" me#domain.com"/><br>
<select name="system" class="selectbox">
<option value="ps4">Playstation 4</option>
<option value="xbone">Xbox One</option>
<option value="wiiu">Wii U</option>
<option value="pc">PC Gaming</option>
</select><br>
<input type="radio" name="genre" value="FPS">First Person Shooter.<br>
<input type="radio" name="genre" value="MOBA">Multiplayer Online Battle Arena.<br>
<input type="radio" name="genre" value="RPG">Role-Playing Game.<br>
<input type="radio" name="genre" value="RTS">Real Time Strategy.<br>
<input type="radio" name="genre" value="Other">Other Genre.<br>
<input type="checkbox" name="subscribe" value="yes" checked>Subscribe for gaming updates and more!<br>
<input type="submit" class="subbtn" value="Done" />
</form>
</div>
</div>
</div>''')
form_foot=textwrap.dedent('''
</body>
</html>''')
#if GET is requested it should display on next screen.
#else should load page.
if self.request.GET:
name=self.request.GET['name']
email=self.request.GET['email']
system=self.request.GET['system']
genre=self.request.GET['genre']
subscribe=self.request.GET['subscribe']
#displays form information submitted by user.
self.response.write(form_head +
textwrap.dedent('''
<div class='maincontainer'>
<h1>Thanks for Subbing!</h1>
<div id="infobox">
<h2></h2>
Name: {name}<br />
Email: {email}<br />
Preferred System: {system}<br />
Preferred Genre: {genre}
</div>
</div>''').format(**locals()) +
form_foot)
#Will display error. ** PLACE HOLDER **
else:
self.response.write("Help! Error!")
# Do not touch this.
app = webapp2.WSGIApplication([('/', MainHandler)], debug=True)
Related
I want to use requests.Sessions() to deliver my login information to a website. Once logged in I want to navigate to a second URL that can only be accessed once logged in. In order to scrape data from the second URL.
I am new to scraping and don't really have any experience with HTML
I am working in collaboratory if that makes any difference.
This is my code and the outputs:
import requests
page = requests.get("https://app.gristanalytics.com/Account/Login")
page
<Response [200]>
page.status_code
200
from bs4 import BeautifulSoup
soup = BeautifulSoup(page.content, 'html.parser')
print(soup.prettify())
This is the output:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/lib/fontawesome/css/all.min.css" rel="stylesheet"/>
<link href="/lib/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
<link href="/lib/vue-multiselect/vue-multiselect.min.css" rel="stylesheet"/>
<link href="/css/site.css" rel="stylesheet"/>
<title>
Log in - Grist
</title>
</head>
<body>
<div>
<div class="text-center loginbox">
<form method="post" style="width:100%;max-width:350px;padding:15px;margin:0 auto;">
<img alt="" class="mb-4" src="/images/grist_logo_m_black.png"/>
<h1 class="h3 mb-3 font-weight-normal">
Please sign in
</h1>
<div class="text-danger validation-summary-valid" data-valmsg-summary="true">
<ul>
<li style="display:none">
</li>
</ul>
</div>
<label class="sr-only" for="inputEmail">
Email address
</label>
<input autofocus="" class="form-control my-1" data-val="true" data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." id="Input_Email" name="Input.Email" placeholder="Email address" required="" type="email" value=""/>
<label class="sr-only" for="inputPassword">
Password
</label>
<input class="form-control my-1" data-val="true" data-val-required="The Password field is required." id="Input_Password" name="Input.Password" placeholder="Password" required="" type="password"/>
<div class="checkbox my-3">
<label>
<input data-val="true" data-val-required="The Remember me? field is required." id="Input_RememberMe" name="Input.RememberMe" type="checkbox" value="true"/>
Remember me
</label>
<p>
<a href="/Account/ForgotPassword">
Forgot your password?
</a>
</p>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">
Sign in
</button>
<p class="mt-5 mb-3 text-muted">
© 2018-2022
</p>
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8CxpSY-tCd5Ou0L0wqhntPACCikaoFBOUQLV0RgCaVUJgt9wRSd3p9aVswNuSLU6OPRKsbIm-qvOyZyZErcEm-E__Q2tPauexh3z_T02Oh5TZCpeY12PsUsERY3INO5LUBBmWXeUR6nG5BFHnnNdW70">
<input name="Input.RememberMe" type="hidden" value="false"/>
</input>
</form>
</div>
</div>
<script src="/lib/jquery-validation/dist/Jquery.validate.min.js">
</script>
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js">
</script>
</body>
</html>
At this point I believe that the field names that I want to deliver the payload are:
name="Input.Email" and name="Input.Password"
However I note that there is no action attribute in the HTML code, so I plan to send the payload to the original URL as you will see below.
payload = {
'Input.Email': 'MyEmail', #yes in practice this is my actual information instead of this placeholder
'Input.Password': 'MyPassword', #same here real password used instead
}
with requests.Session() as session:
post = session.post('https://app.gristanalytics.com/Account/Login', data=payload)
r = session.get('https://app.gristanalytics.com/Data/Brewhouse')
soup = BeautifulSoup(r.content, 'html.parser')
print(soup.prettify())
The output of this is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/lib/fontawesome/css/all.min.css" rel="stylesheet"/>
<link href="/lib/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
<link href="/lib/vue-multiselect/vue-multiselect.min.css" rel="stylesheet"/>
<link href="/css/site.css" rel="stylesheet"/>
<title>
Log in - Grist
</title>
</head>
<body>
<div>
<div class="text-center loginbox">
<form method="post" style="width:100%;max-width:350px;padding:15px;margin:0 auto;">
<img alt="" class="mb-4" src="/images/grist_logo_m_black.png"/>
<h1 class="h3 mb-3 font-weight-normal">
Please sign in
</h1>
<div class="text-danger validation-summary-valid" data-valmsg-summary="true">
<ul>
<li style="display:none">
</li>
</ul>
</div>
<label class="sr-only" for="inputEmail">
Email address
</label>
<input autofocus="" class="form-control my-1" data-val="true" data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." id="Input_Email" name="Input.Email" placeholder="Email address" required="" type="email" value=""/>
<label class="sr-only" for="inputPassword">
Password
</label>
<input class="form-control my-1" data-val="true" data-val-required="The Password field is required." id="Input_Password" name="Input.Password" placeholder="Password" required="" type="password"/>
<div class="checkbox my-3">
<label>
<input data-val="true" data-val-required="The Remember me? field is required." id="Input_RememberMe" name="Input.RememberMe" type="checkbox" value="true"/>
Remember me
</label>
<p>
<a href="/Account/ForgotPassword">
Forgot your password?
</a>
</p>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">
Sign in
</button>
<p class="mt-5 mb-3 text-muted">
© 2018-2022
</p>
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8CxpSY-tCd5Ou0L0wqhntPAwaiYOz80Q50p5gOcDk9qSF-gR4JJpzNGOdSKiQOzcVPp8hBKgDaEwXOrbFnpgdYXkedfcnLQlXIJ1Z7HnIi5vKZybNd6VSKk_Xs5Az444e3Oug-u1UFcxq_OLX1Iu0wU">
<input name="Input.RememberMe" type="hidden" value="false"/>
</input>
</form>
</div>
</div>
<script src="/lib/jquery-validation/dist/Jquery.validate.min.js">
</script>
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js">
</script>
</body>
</html>
Which is the same HTML as the first time, it is clear that I am not logged in, and as a result I can't get to the HTML code of the URL I want.
I have tried other variations for the payload field names including:
inputEmail (from for=)
Input_Email (from id=)
email (from type=)
sample code for variation 1 would be
payload = {
'inputEmail': 'MyEmail', #yes in practice this is my actual information instead of this placeholder
'inputPassword': 'MyPassword', #same here real password used instead
}
I get no error or warning messages when running this code so I'm a bit stuck as to what to do.
The following code helped me to login and get me where I wanted to go!
Big thank you to #bushcat69 for the help he provided, I probably wouldn't have looked seriously at the verification token without them.
As well as the following [1, 2] stack exchange posts for additional information that I used.
with requests.Session() as session:
read = session.get('https://app.gristanalytics.com/Account/Login')
soup = BeautifulSoup(read.content, 'html.parser')
token = soup.select_one('[name="__RequestVerificationToken"]').get('value')
payload = {
'Input.Email': 'MyEmail#email.com',
'Input.Password': 'MyPassword',
'__RequestVerificationToken': token,
'Input.RememberMe': 'false'
}
post = session.post('https://app.gristanalytics.com/Account/Login', data=payload)
r = session.get('https://app.gristanalytics.com/Data/Brewhouse')
tastySoup = BeautifulSoup(r.content, 'html.parser')
print(tastySoup.prettify())
I am now having issues where it seems that some of the content that I want to scrape is working through Ajax / javascript which I don't know how to get. If you're having similar issues look into my future questions, I will also leave a comment here with the stackexchange/whatever website if I find content that helps me figure it out.
first of all i wanted to say that im quite new to python and selenium in particular.
Me and a co-worker are trying to automate a web app to sort payments for us.
everything works up to the part where a pop window appears.This pop up basically its a credit card form.
The Issue is:
You can only interact with the fields, the two buttons and you can close it using the "X".
you cant inspect with developer tools, and i cant download any other programs for that because its
a work computer.
the things i found so far are the link as you can see in the address bar, and i was able to inspect it with the developer tools 'Network' tab.
here is the code that is in the window:
<html>
<head>
<title> ÷ìéèú ôøèé àùøàé </title>
</head>
<body>
<BR>
<iframe id="iFrame" width="100%" height="100%" src="" frameborder="0" ></iframe>
<script Language="JavaScript">
if (typeof(window.dialogArguments)!="undefined") document.getElementById('iFrame').src = window.dialogArguments;
</script>
</body>
</html>
the following is the code which sits inside the page itself (the input fields etc.):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<script src="merchantPages/WebSources/js/HE.js"></script>
<script src="merchantPages/leaseacar/js/main.js"></script>
<script src="merchantPages/leaseacar/js/tafnitTrack2.js"></script>
<link href="merchantPages/WebSources/css/main.rtl.css" rel="stylesheet" type="text/css" />
<title>דף תשלום מאובטח</title>
</head>
<body onload="resetForm();">
<!-- DISPLAY TRANSACTION INFORMATION -->
<div id="main_frame" align="center">
<div id="main">
<div id="page_title"><img id="ssl_logo" src="merchantPages/WebSources/images/ssl.png" alt="" title=""/><h1>דף תשלום מאובטח</h1></div>
<div id="logo"><img src="merchantPages/leaseacar/images/eTafnit.gif" alt="" title="" width="87" height="118"/></div>
<div class="sep"></div>
<div id="page_desc">
<em>עמוד זה הינו עמוד התשלום עבור העסקה שביצעת באתר.<br />תשלום בעבור ההזמנה יבוצע רק לאחר בחירה בכפתור "שליחה" שבתחתית המסך.<br />אנא אשר תחילה כי כל הפרטים בדף זה נכונים והזן את פרטי כרטיס האשראי כנדרש.</em>
</div>
<form id="creditForm" onsubmit="return formValidator(10);" method="POST" action="ProcessCreditCard">
<input type="hidden" name="txId" value="0ce8b10c-2550-4293-ac6b-fee0b61c5b80"/>
<input type="hidden" name="lang" value="HE"/>
<input type="hidden" name="last4d" value="" autocomplete="off" />
<input type="hidden" name="cavv" value="" autocomplete="off" />
<input type="hidden" name="eci" value="" autocomplete="off" />
<input type="hidden" name="transactionCode" value="Phone" autocomplete="off" />
<input type="hidden" name="expMonth" value="10" autocomplete="off" />
<input type="hidden" name="expYear" value="24" autocomplete="off" />
<input type="hidden" name="personalId" value="" autocomplete="off" />
<input type="hidden" name="userData1" value=""/>
<input type="hidden" name="userData2" value=""/>
<input type="hidden" name="userData3" value=""/>
<input type="hidden" name="userData4" value=""/>
<input type="hidden" name="userData5" value=""/>
<input type="hidden" name="userData6" value=""/>
<input type="hidden" name="userData7" value=""/>
<input type="hidden" name="userData8" value=""/>
<input type="hidden" name="userData9" value=""/>
<input type="hidden" name="userData10" value=""/>
<table class="data_tbl">
<thead>
<td colspan="4" class="td_style_1">הזנת פרטי כרטיס אשראי לתשלום</td>
</thead>
<tr>
<td class="td_style_fieldName">Card Number:</td>
<td><input type="text" id="cardNumber" name="cardNumber" maxlength="19"
style="width: 160px;" autocomplete="off" onchange="validateCardNumber();"/></td>
<td class="td_style_invalidField" id="invalidCardNumber"> </td>
</tr>
<tr>
<td class="td_style_fieldName">CVV:</td>
<td><input type="text" name="cvv" id="cvv" maxlength="4" style="width: 50px;" autocomplete="off" onchange="validateCvv();"/> <img src="merchantPages/WebSources/images/qm.png" onmouseover="showHideCVVhelp();" onmouseout="showHideCVVhelp();" style="cursor:pointer;"/><div id="CVVhelp" style="display: none; position: absolute; border: 1px #cccccc solid; padding: 10px; background: white;"><img src="merchantPages/WebSources/images/cvv.jpg" /></div></td>
<td class="td_style_invalidField" id="invalidCvv"> </td>
</tr>
<tr>
<td class="td_style_fieldName">Track2:</td>
<td><input type="password" name="track2" id="track2" value="" autocomplete="off" onchange="tafnitValidateTrack2();"/></td>
<td class="td_style_invalidField" id="invalidTrack2"> </td>
</tr>
</table>
<div id="form_buttons"><input type="submit" id="submitBtn" value="שליחה" /> | <input id="resetBtn" type="reset" value="ניקוי" /></div>
</form>
</div>
<br />
<img src="merchantPages/WebSources/images/rapidssl.gif" alt="" title=""/>
</div>
</body>
</html>
if someone could give me some advice on how could i target the window so i can close, or if its even possible.
this is what i got so far:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
#IMPORTS!-------------------------------------
usr = "***"
pwd = "***"
#app.
driver = webdriver.Ie(executable_path='C:/Users/natbag/Desktop/proj/IEDriverServer.exe')
driver.get('http://111.10.10.10/MENU1/LOGIN7.CSP')
driver.implicitly_wait(10)
username_box = driver.find_element_by_id('Username')
username_box.clear()
username_box.send_keys(usr)
password_box = driver.find_element_by_id('Password')
password_box.send_keys(pwd)
login_btn = driver.find_element_by_xpath('//input[#type="submit"]').click()
#------------------------End of Login ------------------------------------
#update contract page ----------
upd_con = driver.find_element_by_partial_link_text('עדכון חוזה').click()
#input latest Contract (F7) ----
input_con = driver.find_element_by_id('HOZ').send_keys(Keys.F7)
#goto receipts --------
receipts_btn = driver.find_element_by_xpath('//input[#name="BKBL"]').click()
Alert(driver).accept()
#input employee name ----- F7 for now later can be changed for custom number -----
work_name = driver.find_element_by_xpath('//input[#name="OVED"]').send_keys(Keys.F7)
#Receipts after username --------------------
receipts_btkn = driver.find_element_by_xpath('//input[#name="BTKBL"]').click()
#2 Seconds SLEEP IS MANDATORY!!! ----
#select Credit Card by Last Value (F7) can be changed to custom value
cc = driver.find_element_by_id('KSM').send_keys(Keys.F7)
#-------------- CANT INTERACT WITH CC WINDOW -----------------
WebDriverWait(driver, 5).until(EC.frame_to_be_available_and_switch_to_it((driver.find_element_by_xpath('//iframe[#id"iFrame"]'))))
#WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[#type='text'] and [#id='cvv']"))).click()
sorry for the long post,
thanks in advance
Well i figured it out using pyautogui.
tnx everyone
I'm pretty new to html coding. I am trying to implement a simple application that asks the user to input a salutation, first name, and last name. Upon submission, instead of storing the names into a database, I just want an alert or print statement to appear below the form itself that says "Welcome" + salutation + last name.
I thought I could just implement this using a simple python script and an html file that holds all the contents. Is there something more to this?
app.py
#!/usr/bin/env python3
from flask import Flask, render_template
app = Flask(__name__)
#app.route("/")
def main():
return render_template('form.html')
if __name__ == "__main__":
app.run()
form.html
<html lang="en">
<body>
<div class="container">
<div class="jumbotron">
<h1>Gettin' a feel for docker</h1>
<form class="form" method= "post" onSubmit= "alert('Welcome')">
<label for="salutation" class="sr-only">Salutation</label>
<input type="salutation" name="salutation" id="salutation" class="form-control" required autofocus><br>
<label for="firstName" class="sr-only">First Name</label>
<input type="name" name="firstName" id="firstName" class="form-control" required autofocus><br>
<label for="lastName" class="sr-only">Last Name</label>
<input type="name" name="lastName" id="lastName" class="form-control" required><br>
<button id="submit" class="btn btn-lg btn-primary btn-block" type="button">Submit</button>
</form>
</div>
</div>
</body>
</html>
In order to dynamically display the results of the user input upon a button click, you will have to use jquery.
<html>
<header>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</header>
<body>
<div class='wrapper'>
<input type='text' id='salutation'>
<input type='text' id='firstname'>
<input type='text' id='lastname'>
<button class='get_greeting'>Display</button>
<div class='results'></div>
</div>
</body>
<script>
$(document).ready(function(){
$('.wrapper').on('click', '.get_greeting', function(){
$('.results').html('<p>Welcome, '+$('#salutation').val()+' '+$('#firstname').val()+' '+$('#lastname').val()+'</p>')
});
});
</script>
</html>
The code as per your requirement in form.html should be as follow :
<html lang="en">
<body>
<div class="container">
<div class="jumbotron">
<h1>Gettin' a feel for docker</h1>
<form class="form" method= "post" onSubmit= "alert('Welcome')">
<label for="salutation" class="sr-only">Salutation</label>
<input type="salutation" name="salutation" id="salutation" class="form-control" required autofocus><br>
<label for="firstName" class="sr-only">First Name</label>
<input type="name" name="firstName" id="firstName" class="form-control" required autofocus><br>
<label for="lastName" class="sr-only">Last Name</label>
<input type="name" name="lastName" id="lastName" class="form-control" required><br>
<button id="submit" class="btn btn-lg btn-primary btn-block" type="button" onclick="show_alert()">Submit</button>
</form>
</div>
</div>
<script type="text/javascript">
function show_alert(){
alert("Welcome, "+ document.getElementById('salutation').value + " " + document.getElementById('firstName').value + " " + document.getElementById('lastName').value);
}
</script>
</body>
</html>
<html>
<head>
<title>Insert Data into DB</title>
</head>
<body>
<hl><br>Insert Data into DB</hl>
<form method="post" action="" name="form1">
<fieldset>
<legend>Slot Status</legend>
<label>slot:<input type="text" name="fname" /></label>
<label>status:<input type="text" name="lname" /></label>
</fieldset>
<br />
<input type="submit" name="submit" value="Update Slot Status" />
</form>
</body>
</html>
Sir above is a simple html form I made and i want to fill this form using python Script.Especially I want to use the mechanize module. Any help will be highly appreciated. Thank You.
I am using bottle framework and python to make a website. After using bootstrap, the submit button of my form is not working.
Here is my code in the button3.tpl file:
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h1>Insert Artist</h1>
</div>
<hr>
<div class="container"
<form role="form" method="post" action="/result4">
<div class="form-group">
<laber>National ID</label>
<input class="form-control" type="text" name="ID" value=""><br>
</div>
<div class="form-group">
<laber>Name</label>
<input class="form-control" type="text" name="Name" value=""><br>
</div>
<div class="form-group">
<laber>Surname</label>
<input class="form-control" type="text" name="Surname" value=""><br>
<div class="form-group">
<label>Birth Year</label>
<input class="form-control" type="number" name="Birth" min="1900" max="2016"><br>
</div>
<input class="form-control" type="submit" value="Update Information">
</form>
</div>
<hr>
</body>
Why does it not redirect in the proper link ?