Keyword argument repeated in python Flask - python

I'm trying to build restaurant list site using Flask.
This is a part of my application.py code.
#application.route("/list.html")
def list_restaurants():
page = request.args.get("page", 0, type=int)
limit = 4
category = request.args.get("category", "all")
price = request.args.get("price", "all")
area = request.args.get("area", "all")
start_idx = limit*page
end_idx = limit*(page+1)
if category=="all" and price=="all" and area=="all":
data = DB.get_restaurants()
else:
if category != "all" and price=="all" and area=="all":
data = DB.get_restaurants_bycategory(category)
elif price != "all" and category=="all" and area=="all":
data = DB.get_restaurants_byprice(price)
elif area != "all" and category=="all" and price=="all":
data = DB.get_restaurants_byarea(area)
else:
data = DB.get_restaurants()
tot_count = len(data)
if tot_count<=limit:
data = dict(list(data.items())[:tot_count])
else:
data = dict(list(data.items())[start_idx:end_idx])
data = dict(sorted(data.items(), key=lambda x:x[1]['res_name'], reverse=False))
#print(data)
page_count=len(data)
return render_template(
"list.html",
datas=data.items(),
total=tot_count,
limit=limit,
page=page,
page_count=math.ceil(tot_counet/4),
category=category,
price=price,
area=area)
This is the python code calling the HTML page where the error is taking place.
The HTML page (list.html):
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title>search</title>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="{{ url_for('static', filename='main.js') }}" defer></script>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<style src="{{ url_for('static', filename='index.css') }}"></style>
</head>
<body>
<div class="header" id="logo" onclick="location.href='list.html'">
<img src="/static/YomoJomoLogo.png" width="150px" />
</div>
<div class="contents">
<div class="searchbar">
<form>
<div class="searchbox">
<a style="color: black;">검색</a>
<input
type="text"
name="search"
style="width: 80%; height: 30px;"
placeholder="Search by restaurant name or menu name."
/>
<input
type="button"
name="search"
onclick="location.href='search3.html'"
name="search"
value="search"
/>
</div>
<div class="login">
<div></div>
<input
class="loginbutton"
type="button"
onclick="location.href='login.html'"
name="login"
value="login"
/>
<input
class="regbutton"
type="button"
onclick="location.href='register_restaurant.html'"
name="register"
value="register"
/>
</div>
</form>
</div>
<br /><br /><br />
<nav>
<script>
$(document).ready(function () {
//alert("{{category}}");
$('#category option:contains("{{category}}")').prop('selected', true);
});
</script>
<div class="menu">
<ul>
<li>
<a>Category</a>
<ul id="category" name="category" onchange="location=this.value">
<li>
<a
href="{{url_for('list_restaurants', page=i, category='Korean', price='all', area='all')}}"
>Korean</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, category='Italian', price='all', area='all')}}"
>Italian</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, category='Chinese', price='all', area='all')}}"
>Chinese</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, category='Japanese', price='all', area='all')}}"
>Japanese</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, category='Cafeteria', price='all', area='all')}}"
>Cafeteria</a
>
</li>
</ul>
</li>
<li>
<a>Price</a>
<ul id="price" name="price" onchange="location=this.value">
<li>
<a
href="{{url_for('list_restaurants', page=i, price='below 5', category='all', area='all')}}"
>below 5</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, price='5-10', category='all', area='all')}}"
>below 10</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, price='10-15', category='all', area='all')}}"
>below 15</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, price='15-20', category='all', area='all')}}"
>below 20</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, price='above 20', category='all', area='all')}}"
>above 20</a
>
</li>
</ul>
</li>
<li>
<a>Area</a>
<ul id="area" name="area" onchange="location=this.value">
<li>
<a
href="{{url_for('list_restaurants', page=i, area='school', category='all', price='all')}}"
>school</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, area='front', category='all', price='all')}}"
>front</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, area='back', category='all', price='all')}}"
>back</a
>
</li>
<li>
<a
href="{{url_for('list_restaurants', page=i, area='etc', category='all', price='all')}}"
>etc</a
>
</li>
</ul>
</li>
<li style="float: right;">random</li>
</ul>
</div>
</nav>
{% if total > 0 %}
<p style="text-align: center;">
<br />restaurant list - {{total}}<br /><br />
</p>
{% for data in datas %}
<div style="float: left; width: 25%;">
<div style="text-align: center;">
<a href="/view_detail/{{data[1].res_name}}/">
<p style="color: black;">{{data[1].res_name}}</p>
<img src="/static/image/{{data[1].img_path}}" width="200" /></a
><br />
</div>
</div>
{% endfor %}
<!---pagenation-->
<div class="page-wrap" style="clear: both;">
<br /><br />
<div class="page-nation">
<ul>
<li>
{% for i in range(page_count)%}
{{i+1}}
{% endfor %}
</li>
</ul>
<br /><br />
</div>
</div>
{% else %}
<p class="ranking">
Search Result
</p>
<div style="margin: 20px;">
<p style="text-align: center;">No result.<br /><br /></p>
<div
style="
float: left;
margin-left: 150px;
padding: 40px;
border-radius: 5%;
text-align: center;
background-color: #f3f3f3;
"
>
Register a new restaurant<br /><br />
<input
type="button"
onclick="location.href='register_restaurant.html'"
name="register"
style="height: 30px; background-color: #738b5f; border: none; color: white;"
value="register a new restaurant"
/>
</div>
<div
style="
float: right;
margin-right: 150px;
padding: 40px;
border-radius: 5%;
text-align: center;
background-color: #f3f3f3;
"
>
Random recommendation<br /><br />
<input
type="button"
onclick="location.href='search5.html'"
name="register"
style="height: 30px; background-color: #738b5f; border: none; color: white;"
value="random recommendation"
/>
</div>
{% endif %}
</div>
</div>
</body>
This is the error code.
Traceback (most recent call last)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/workspace/flask/application.py", line 108, in list_restaurants
area=area)
File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 138, in render_template
ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 930, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 883, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 857, in _load_template
template = self.loader.load(self, name, globals)
File "/usr/local/lib/python3.7/site-packages/jinja2/loaders.py", line 127, in load
code = environment.compile(source, name, filename)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 636, in compile
return self._compile(source, filename)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 601, in _compile
return compile(source, filename, "exec")
File "/workspace/flask/templates/list.html", line 57
^
SyntaxError: keyword argument repeated
It keeps pointing the same line, not a specific part of the code.
I tried adding blank lines on line 57, and it points the same line syntax error. The code was working well and suddenly it stopped. I have no idea how to deal with this 'keyword argument repeated' syntax error. Looking for some advices!

<input
type="button"
name="search"
onclick="location.href='search3.html'"
name="search"
value="search"
/>
You're using name="..." twice.

Related

How to submit input type = range in flask

While trying to submit input type = range i'm getting "Bad request error".
HTML:
{% extends "base.html" %} {% block content %} <head>
<link rel="stylesheet" href="css/style.css" />
</head>
<div class="search-bar">
<div class="rt-container">
<form method="post" action="#">
<div class="col-rt-12">
<div class="Scriptcontent">
<!-- Range Slider HTML -->
<div slider id="slider-distance">
<div>
<div inverse-left style="width: 70%"></div>
<div inverse-right style="width: 70%"></div>
<div range style="left: 30%; right: 40%"></div>
<span thumb style="left: 30%"></span>
<span thumb style="left: 60%"></span>
<div sign style="left: 30%">
<span id="value">0</span>
</div>
<div sign style="left: 60%">
<span id="value">100</span>
</div>
</div>
<input name="max" type="range" tabindex="0" value="30" max="100" min="0" step="1" oninput="
this.value=Math.min(this.value,this.parentNode.childNodes[5].value-1);
var value=(100/(parseInt(this.max)-parseInt(this.min)))*parseInt(this.value)-(100/(parseInt(this.max)-parseInt(this.min)))*parseInt(this.min);
var children = this.parentNode.childNodes[1].childNodes;
children[1].style.width=value+'%';
children[5].style.left=value+'%';
children[7].style.left=value+'%';children[11].style.left=value+'%';
children[11].childNodes[1].innerHTML=this.value;" />
<input name="min" type="range" tabindex="0" value="60" max="100" min="0" step="1" oninput="
this.value=Math.max(this.value,this.parentNode.childNodes[3].value-(-1));
var value=(100/(parseInt(this.max)-parseInt(this.min)))*parseInt(this.value)-(100/(parseInt(this.max)-parseInt(this.min)))*parseInt(this.min);
var children = this.parentNode.childNodes[1].childNodes;
children[3].style.width=(100-value)+'%';
children[5].style.right=(100-value)+'%';
children[9].style.left=value+'%';children[13].style.left=value+'%';
children[13].childNodes[1].innerHTML=this.value;" />
<input id="search" type="submit" value="SEARCH" href="#"></input>
</div>
</form>
</div>
</div>
</div>
<form action="/lobbies" method="POST">
<input type="checkbox" name="IsVisible" value="0" default="0">Private?</input>
<input type="text" name="LobbyValue" placeholder="Value" href="#" required></input>
<input type="submit" value="CREATE" href="#"></input>
</form>
</div>
<div class="container"> {% for lobby in data%} <div class="lobby-item">
<div class="lobby-coins">
<img src="static/StashedCoins.png" alt="coin" width="32px" height="32px" /> {% print lobby['GameValue']%}
</div>
<div class="lobby-photo">
<a href="/Player/{{lobby['PlayerOneID']}}">
<img src=https://robohash.org/{{lobby['CreatorName']}} alt="coin" width="110px" height="110px" />
</a>
</div>
<div class="lobby-join">
Join
</div>
</div>
{%endfor%}
</div>
{% endblock %}
Flask:
#app.route("/lobbies", methods=["GET", "POST"])
def lobbies():
if "username" in session:
coins = requests.get(API_URL + "/GetUserBalance/" + str(session["id"])).json()[
"balance"
]
ProfilePicture = "https://robohash.org/" + str(session["username"])
color = str(session["color"])
PlayerID = session["PlayerID"]
if request.method == "POST":
LobbyValue = request.form['LobbyValue']
if "IsVisible" in request.form:
response = requests.post(API_URL + "/CreateNewLobby", params={"ApiUser": API_USER,"PlayerID": PlayerID, "IsVisible": 0, "LobbyValue": LobbyValue}).json()
else:
response = requests.post(API_URL + "/CreateNewLobby", params={"ApiUser": API_USER,"PlayerID": PlayerID, "LobbyValue": LobbyValue}).json()
LobbyID = response['LobbyID']
return redirect(url_for('lobby',LobbyID=LobbyID))
data = requests.get(API_URL + "/GetLobbies", params={"PlayerID": PlayerID})
return render_template(
"lobbies.html",
coins=coins,
ProfilePicture=ProfilePicture,
color=color,
data=data.json(),
)
else:
return redirect(url_for("login"))
I dont understand what im doing wrong here.
I want to give user a slider with two handlers like this:
So they can filter the lobbies within the price range set in slider. I need in this example number 0 and 69 to be send to my flask app so i can then display lobbies within the price range.

HttpResponseRedirect working properly but not redirecting to the next page, how can I solve that problem?

Currently I am building a resume builder website, but the problem is I can't redirect the user to the next page, it surely has problem with frontend, because backend worked properly and as I expected, because as you see the code down below, before the httpresponseredirect() method, it printed what I want, but it did not redirect the page to the next...
This is not my first time question I gave this question before as well. I approached to the solution after my first time question, but now again problem, then I thought asking from stackoverflow was good idea!
{% load static %}
<!DOCTYPE html>
<html style="font-size: 16px;" lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="keywords" content="Let&apos;s start with personal information">
<meta name="description" content="">
<title>Page 1</title>
<link rel="stylesheet" href="{% static 'css/nicepage.css' %}" media="screen">
<link rel="stylesheet" href="{% static 'css/Page-1.css' %}" media="screen">
<script class="u-script" type="text/javascript" src="{% static 'js/jquery.js' %}" defer=""></script>
<script class="u-script" type="text/javascript" src="{% static 'js/nicepage.js' %}" defer=""></script>
<meta name="generator" content="Nicepage 4.18.5, nicepage.com">
<link id="u-theme-google-font" rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i|Open+Sans:300,300i,400,400i,500,500i,600,600i,700,700i,800,800i">
<script type="application/ld+json">{
"#context": "http://schema.org",
"#type": "Organization",
"name": "",
"logo": "images/Untitled1.png",
"sameAs": [
"https://facebook.com/name",
"https://twitter.com/name",
"https://instagram.com/name"
]
}</script>
<meta name="theme-color" content="#478ac9">
<meta name="twitter:site" content="#">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Page 1">
<meta name="twitter:description" content="">
<meta property="og:title" content="Page 1">
<meta property="og:type" content="website">
</head>
<body class="u-body u-xl-mode" data-lang="en">
<header class="u-clearfix u-header" id="sec-f68e">
<div class="u-clearfix u-sheet u-valign-middle-xl u-sheet-1">
<a href="https://nicepage.com" class="u-image u-logo u-image-1" data-image-width="156" data-image-height="63">
<img src="{% static 'images/Untitled1.png' %}" class="u-logo-image u-logo-image-1">
</a>
<nav class="u-menu u-menu-one-level u-offcanvas u-menu-1">
<div class="menu-collapse" style="font-size: 1rem; letter-spacing: 0px;">
<a class="u-button-style u-custom-left-right-menu-spacing u-custom-padding-bottom u-custom-top-bottom-menu-spacing u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="#">
<svg class="u-svg-link" viewBox="0 0 24 24">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#menu-hamburger"></use>
</svg>
<svg class="u-svg-content" version="1.1" id="menu-hamburger" viewBox="0 0 16 16" x="0px" y="0px"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<g>
<rect y="1" width="16" height="2"></rect>
<rect y="7" width="16" height="2"></rect>
<rect y="13" width="16" height="2"></rect>
</g>
</svg>
</a>
</div>
<div class="u-custom-menu u-nav-container">
<ul class="u-nav u-unstyled u-nav-1">
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="Home.html" style="padding: 10px 20px;">Home</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="#" style="padding: 10px 20px;">Contact</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
style="padding: 10px 20px;">Sign-up</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
style="padding: 10px 20px;">Login</a>
</li>
</ul>
</div>
<div class="u-custom-menu u-nav-container-collapse">
<div class="u-black u-container-style u-inner-container-layout u-opacity u-opacity-95 u-sidenav">
<div class="u-inner-container-layout u-sidenav-overflow">
<div class="u-menu-close"></div>
<ul class="u-align-center u-nav u-popupmenu-items u-unstyled u-nav-2">
<li class="u-nav-item"><a class="u-button-style u-nav-link" href="Home.html">Home</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link" href="#">Contact</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link">Sign-up</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link">Login</a>
</li>
</ul>
</div>
</div>
<div class="u-black u-menu-overlay u-opacity u-opacity-70"></div>
</div>
</nav>
</div>
</header>
<section class="u-clearfix u-section-1" id="sec-800b">
<div class="u-clearfix u-sheet u-valign-top u-sheet-1">
<div class="u-container-style u-expanded-width u-group u-image u-image-default u-image-1" data-image-width="360"
data-image-height="360">
<div class="u-container-layout u-container-layout-1">
<h2 class="u-text u-text-default u-text-1">Let's start with <br>personal information
</h2>
<div class="u-expanded-width-sm u-expanded-width-xs u-form u-form-1">
<form action="{% url 'start_process' %}" method="post"
class="u-clearfix u-form-spacing-10 u-form-vertical u-inner-form" source="email" name="form"
style="padding: 10px;">
{% csrf_token %}
<div class="u-form-group u-form-name">
<!-- <label for="name-86ce" class="u-label">Name</label>-->
<!-- <input type="text" placeholder="Enter your name" id="name-86ce" name="name"-->
<!-- class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">-->
{{ form }}
</div>
<div class="u-form-email u-form-group">
<label for="email-86ce" class="u-label">Email</label>
<input type="email" placeholder="Enter a valid email address" id="email-86ce" name="email"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-phone u-form-group-3">
<label for="phone-9974" class="u-label">Phone</label>
<input type="tel"
pattern="\+?\d{0,3}[\s\(\-]?([0-9]{2,3})[\s\)\-]?([\s\-]?)([0-9]{3})[\s\-]?([0-9]{2})[\s\-]?([0-9]{2})"
placeholder="Enter your phone (e.g. +14155552675)" id="phone-9974" name="phone"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-4">
<label for="text-d550" class="u-label">Input</label>
<input type="text" placeholder="" id="text-d550" name="text"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-5">
<label for="text-10ad" class="u-label">Input</label>
<input type="text" placeholder="" id="text-10ad" name="text-1"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-align-left u-form-group u-form-submit">
<a href="#"
class="u-btn u-btn-round u-btn-submit u-button-style u-radius-11 u-btn-1">Back<br>
</a>
<input type="submit" value="submit" class="u-form-control-hidden">
</div>
<input type="submit"
class="u-btn u-btn-round u-button-style u-hover-feature u-hover-palette-1-light-2 u-radius-7 u-btn-2"
data-animation-name="pulse" data-animation-duration="1000"
data-animation-direction=""/>
</form>
</div>
<img class="u-image u-image-circle u-preserve-proportions u-image-2"
src="{% static 'images/images.jfif' %}" alt=""
data-image-width="201" data-image-height="251">
<h4 class="u-text u-text-2">We ensure that your ​​personal <br>information won't store anywhere!
</h4>
</div>
</div>
</div>
</section>
<footer class="u-align-center u-clearfix u-footer u-grey-80 u-footer" id="sec-56ea">
<div class="u-clearfix u-sheet u-valign-middle-lg u-valign-middle-md u-valign-middle-sm u-valign-middle-xs u-sheet-1">
<p class="u-small-text u-text u-text-variant u-text-1">Contact us!</p>
<a href="https://nicepage.review"
class="u-active-none u-bottom-left-radius-0 u-bottom-right-radius-0 u-btn u-btn-rectangle u-button-style u-hover-none u-none u-radius-0 u-top-left-radius-0 u-top-right-radius-0 u-btn-1"><span
class="u-icon"><svg class="u-svg-content" viewBox="0 0 405.333 405.333" x="0px" y="0px"
style="width: 1em; height: 1em;"><path
d="M373.333,266.88c-25.003,0-49.493-3.904-72.704-11.563c-11.328-3.904-24.192-0.896-31.637,6.699l-46.016,34.752 c-52.8-28.181-86.592-61.952-114.389-114.368l33.813-44.928c8.512-8.512,11.563-20.971,7.915-32.64 C142.592,81.472,138.667,56.96,138.667,32c0-17.643-14.357-32-32-32H32C14.357,0,0,14.357,0,32 c0,205.845,167.488,373.333,373.333,373.333c17.643,0,32-14.357,32-32V298.88C405.333,281.237,390.976,266.88,373.333,266.88z"></path></svg><img></span> +998
(94) 005-55-65
</a>
<a href="mailto:info#site.com"
class="u-active-none u-bottom-left-radius-0 u-bottom-right-radius-0 u-btn u-btn-rectangle u-button-style u-hover-none u-none u-radius-0 u-text-body-alt-color u-top-left-radius-0 u-top-right-radius-0 u-btn-2"><span
class="u-icon u-icon-2"><svg class="u-svg-content" viewBox="0 0 24 16" x="0px" y="0px"
style="width: 1em; height: 1em;"><path fill="currentColor" d="M23.8,1.1l-7.3,6.8l7.3,6.8c0.1-0.2,0.2-0.6,0.2-0.9V2C24,1.7,23.9,1.4,23.8,1.1z M21.8,0H2.2
c-0.4,0-0.7,0.1-1,0.2L10.6,9c0.8,0.8,2.2,0.8,3,0l9.2-8.7C22.6,0.1,22.2,0,21.8,0z M0.2,1.1C0.1,1.4,0,1.7,0,2V14
c0,0.3,0.1,0.6,0.2,0.9l7.3-6.8L0.2,1.1z M15.5,9l-1.1,1c-1.3,1.2-3.6,1.2-4.9,0l-1-1l-7.3,6.8c0.2,0.1,0.6,0.2,1,0.2H22
c0.4,0,0.6-0.1,1-0.2L15.5,9z"></path></svg><img></span> pythondeveloper441#gmail.com
</a>
<div class="u-social-icons u-spacing-10 u-social-icons-1">
<a class="u-social-url" title="facebook" target="_blank" href="https://facebook.com/name"><span
class="u-icon u-social-facebook u-social-icon u-text-palette-1-dark-1 u-icon-3"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-6621"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-6621"><circle fill="currentColor"
cx="56.1" cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M73.5,31.6h-9.1c-1.4,0-3.6,0.8-3.6,3.9v8.5h12.6L72,58.3H60.8v40.8H43.9V58.3h-8V43.9h8v-9.2
c0-6.7,3.1-17,17-17h12.5v13.9H73.5z"></path></svg></span>
</a>
<a class="u-social-url" title="twitter" target="_blank" href="https://twitter.com/name"><span
class="u-icon u-social-icon u-social-twitter u-text-palette-1-dark-1 u-icon-4"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-30eb"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-30eb"><circle fill="currentColor"
class="st0" cx="56.1"
cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M83.8,47.3c0,0.6,0,1.2,0,1.7c0,17.7-13.5,38.2-38.2,38.2C38,87.2,31,85,25,81.2c1,0.1,2.1,0.2,3.2,0.2
c6.3,0,12.1-2.1,16.7-5.7c-5.9-0.1-10.8-4-12.5-9.3c0.8,0.2,1.7,0.2,2.5,0.2c1.2,0,2.4-0.2,3.5-0.5c-6.1-1.2-10.8-6.7-10.8-13.1
c0-0.1,0-0.1,0-0.2c1.8,1,3.9,1.6,6.1,1.7c-3.6-2.4-6-6.5-6-11.2c0-2.5,0.7-4.8,1.8-6.7c6.6,8.1,16.5,13.5,27.6,14
c-0.2-1-0.3-2-0.3-3.1c0-7.4,6-13.4,13.4-13.4c3.9,0,7.3,1.6,9.8,4.2c3.1-0.6,5.9-1.7,8.5-3.3c-1,3.1-3.1,5.8-5.9,7.4
c2.7-0.3,5.3-1,7.7-2.1C88.7,43,86.4,45.4,83.8,47.3z"></path></svg></span>
</a>
<a class="u-social-url" title="instagram" target="_blank" href="https://instagram.com/name"><span
class="u-icon u-social-icon u-social-instagram u-text-palette-1-dark-1 u-icon-5"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-21f5"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-21f5"><circle fill="currentColor"
cx="56.1" cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M55.9,38.2c-9.9,0-17.9,8-17.9,17.9C38,66,46,74,55.9,74c9.9,0,17.9-8,17.9-17.9C73.8,46.2,65.8,38.2,55.9,38.2
z M55.9,66.4c-5.7,0-10.3-4.6-10.3-10.3c-0.1-5.7,4.6-10.3,10.3-10.3c5.7,0,10.3,4.6,10.3,10.3C66.2,61.8,61.6,66.4,55.9,66.4z"></path><path
fill="#FFFFFF"
d="M74.3,33.5c-2.3,0-4.2,1.9-4.2,4.2s1.9,4.2,4.2,4.2s4.2-1.9,4.2-4.2S76.6,33.5,74.3,33.5z"></path><path
fill="#FFFFFF" d="M73.1,21.3H38.6c-9.7,0-17.5,7.9-17.5,17.5v34.5c0,9.7,7.9,17.6,17.5,17.6h34.5c9.7,0,17.5-7.9,17.5-17.5V38.8
C90.6,29.1,82.7,21.3,73.1,21.3z M83,73.3c0,5.5-4.5,9.9-9.9,9.9H38.6c-5.5,0-9.9-4.5-9.9-9.9V38.8c0-5.5,4.5-9.9,9.9-9.9h34.5
c5.5,0,9.9,4.5,9.9,9.9V73.3z"></path></svg></span>
</a>
</div>
</div>
</footer>
<section class="u-backlink u-clearfix u-grey-80">
<a class="u-link" href="https://nicepage.com/website-templates" target="_blank">
<span>Website Templates</span>
</a>
<p class="u-text">
<span>created with</span>
</p>
<a class="u-link" href="" target="_blank">
<span>Website Builder Software</span>
</a>.
</section>
</body>
</html>
code above is my frontend
here is my views.py
from django.shortcuts import render
from .forms import PersonalDetailsForm, SingleForm
from django.http import HttpResponseRedirect
personal_details = []
def index(request):
a = "We have got more than 50000 users used our website!"
return render(request, "Home.html", {"a": a})
def template_choice(request):
return render(request, "template_choice.html", {})
def start_building(request):
if request.method == "POST":
form = PersonalDetailsForm(request.POST)
if form.is_valid():
print(True)
fullname = form.cleaned_data["fullname"]
print(fullname)
print(request.method)
return HttpResponseRedirect("https://www.youtube.com")
else:
form = PersonalDetailsForm()
return render(request, "Page-1.html", {"request": request, "form": form})
def work_experience(request):
return render(request, "Page-2.html", {})
def education(request):
return render(request, "education.html", {})
def skills_summary(request):
return render(request, "skills_summary.html", {})
def testing(request):
form = PersonalDetailsForm(request.POST)
if request.method == "POST":
if form.is_valid():
data = form.cleaned_data["fullname"]
print(data)
return render(request, "formsets.html", {"form": form})
here is my urls.py
from django.urls import path
from .views import (
index,
start_building,
template_choice,
testing,
work_experience,
education,
skills_summary
)
prefix = 'v1/requests/'
urlpatterns = [
path("", index, name="homepage"),
path("test/", testing, name="testing"),
path(prefix + "education/", education, name="education"),
path(prefix + "skills_summary/", skills_summary, name="finish"),
path(prefix + "work_experience/", work_experience, name="work_experience"),
path(prefix + "template_choice/", template_choice, name="template"),
path(prefix + "starter/", start_building, name="start_process"),
]
you know, there was a problem with my css!!!!!!!!!!!!!
guys, if you could understand the problem, then here is answer, because in the future other people may suffer this problem and this page will be useful for them, I found my error on my own!!!! I advise that be careful styling forms when you give the form a functionality!
after asking from u all, I tried one more thing that looks like this:
<!--<section class="u-clearfix u-section-1" id="sec-800b">-->
<!-- <div class="u-clearfix u-sheet u-valign-top u-sheet-1">-->
<!-- <div class="u-container-style u-expanded-width u-group u-image u-image-default u-image-1" data-image-width="360"-->
<!-- data-image-height="360">-->
<!-- <div class="u-container-layout u-container-layout-1">-->
<!-- <h2 class="u-text u-text-default u-text-1">Let's start with <br>personal information-->
<!-- </h2>-->
<!-- <div class="u-expanded-width-sm u-expanded-width-xs u-form u-form-1">-->
<form action="{% url 'start_process' %}" method="post"
class="u-clearfix u-form-spacing-10 u-form-vertical u-inner-form"
style="padding: 10px;">
{% csrf_token %}
<div class="u-form-group u-form-name">
<!-- <label for="name-86ce" class="u-label">Name</label>-->
<!-- <input type="text" placeholder="Enter your name" id="name-86ce" name="name"-->
<!-- class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">-->
{{ form }}
</div>
<div class="u-form-email u-form-group">
<label for="email-86ce" class="u-label">Email</label>
<input type="email" placeholder="Enter a valid email address" id="email-86ce" name="email"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-phone u-form-group-3">
<label for="phone-9974" class="u-label">Phone</label>
<input type="tel"
pattern="\+?\d{0,3}[\s\(\-]?([0-9]{2,3})[\s\)\-]?([\s\-]?)([0-9]{3})[\s\-]?([0-9]{2})[\s\-]?([0-9]{2})"
placeholder="Enter your phone (e.g. +14155552675)" id="phone-9974" name="phone"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-4">
<label for="text-d550" class="u-label">Input</label>
<input type="text" placeholder="" id="text-d550" name="text"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-5">
<label for="text-10ad" class="u-label">Input</label>
<input type="text" placeholder="" id="text-10ad" name="text-1"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-align-left u-form-group u-form-submit">
<a href="#"
class="u-btn u-btn-round u-btn-submit u-button-style u-radius-11 u-btn-1">Back<br>
</a>
<input type="submit" value="submit" class="u-form-control-hidden">
</div>
<input type="submit"
class="u-btn u-btn-round u-button-style u-hover-feature u-hover-palette-1-light-2 u-radius-7 u-btn-2"
data-animation-name="pulse" data-animation-duration="1000"
data-animation-direction=""/>
</form>
</div>
<img class="u-image u-image-circle u-preserve-proportions u-image-2"
src="{% static 'images/images.jfif' %}" alt=""
data-image-width="201" data-image-height="251">
<h4 class="u-text u-text-2">We ensure that your ​​personal <br>information won't store anywhere!
</h4>
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</section>-->
meaningly I turned off the style of the form and other container things like div!

How to click on dynamic button using selenium Python?

I am using Selenium Python and trying to access one of the dynamic created buttons which have same names and no ID.
By.XPATH and By.CLASS_NAME not working here. Any suggestions how can I click on this.This is the button I want to click
This is how I am trying
btn=WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, '//*[#id="BsGnbProv"]/div[1]/div[13]/div[2]/div[3]/div[3]/button[2]')))
This is xPath
//*[#id="BsGnbProv"]/div[1]/div[13]/div[2]/div[3]/div[3]/button[2]
This is Button element details
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable:
false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly"
style="white-space: normal;">
<span class="mr-1 fa fa-edit">
</span>
<span>View Configuration</span>
</button>
This is the html of this div containing all buttons
<div data-bind="visible: GeneralProperties.NfCount() > 0, css: { 'bs-inactive': $root.IsInactive }" data-csv-category="Network Function Properties" class="card m-1 flex-shrink-0 ns-toggle"><div class="card-header"><label>Network Function Properties</label></div>
<div class="overflow-auto card-body ns-width-md">
<div class="form-group ns-width-md">
<div class="col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label class="d-block text-truncate property-label text-dark" data-placement="top" data-toggle="tooltip" style="text-decoration: underline;" title="" data-original-title="Function Type">Function Type</label>
</div>
<div class="col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label class="d-block text-truncate property-label text-dark" data-placement="top" data-toggle="tooltip" style="text-decoration: underline;" title="" data-original-title="Managed Element ID">Managed Element ID</label>
</div>
</div>
<!-- ko with: GeneralProperties.PuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="xPU">xPU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="EAB8620065F0">EAB8620065F0</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.CuCpProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CU-CP">CU-CP</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CUCP-at2200-eab8620065f0-1">CUCP-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.CuUpProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CU-UP">CU-UP</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CUUP-at2200-eab8620065f0-1">CUUP-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.DuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="DU">DU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="DU-at2200-eab8620065f0-1">DU-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.RuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="RU">RU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="RU-at2200-eab8620065f0-1">RU-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
</div>
</div>
#Atif, thanks for the detail HTML. Can you try the following XPath:
//button/span[text()='View Configuration']
This will give you the five buttons and then you can take action accordingly. I tried this and it is working fine.

Scrapy list selector

I'm trying to iterate over a list in scrapy, this is the html sample:
<html>
<head>
<base href='http://example.com/' />
<title>Example website</title>
</head>
<body>
<div id='images'>
<a href='image1.html'>Name: My image 1 <br /><img src='image1_thumb.jpg' /></a>
<a href='image2.html'>Name: My image 2 <br /><img src='image2_thumb.jpg' /></a>
<a href='image3.html'>Name: My image 3 <br /><img src='image3_thumb.jpg' /></a>
<a href='image4.html'>Name: My image 4 <br /><img src='image4_thumb.jpg' /></a>
<a href='image5.html'>Name: My image 5 <br /><img src='image5_thumb.jpg' /></a>
</div>
<ol class="jobs">
<li class="job ">
<div id="logoso-listing">
<img width="100" height="100" class="alignleft size-thumbnail wp-image-22824">
</div>
<div id="titlo">
<strong>Text1</strong>
</div>
<div id="type-tag"><span class="jtype permanent">Permanent1</span></div>
<div id="type-tag-prev"><span class="jtype permanent">Permanent1</span></div>
</li>
<li class="job ">
<div id="logoso-listing">
<img width="100" height="100" class="alignleft size-thumbnail wp-image-22824">
</div>
<div id="titlo">
<strong>Text2</strong>
</div>
<div id="type-tag"><span class="jtype permanent">Permanent2</span></div>
<div id="type-tag-prev"><span class="jtype permanent">Permanent2</span></div>
</li>
<li class="job ">
<div id="logoso-listing">
<img width="100" height="100" class="alignleft size-thumbnail wp-image-22824">
</div>
<div id="titlo">
<strong>Text3</strong>
</div>
<div id="type-tag"><span class="jtype permanent">Permanent3</span></div>
<div id="type-tag-prev"><span class="jtype permanent">Permanent3</span></div>
</li>
</ol>
</body>
</html>
And these are the commands for the scrapy crawler:
content = response.xpath("//ol[#class = 'jobs']")
job_list = content.xpath("//li[contains(#class,'job')]")
for job in job_list:
job.xpath("//div[#id = 'titlo']/strong/a/text()").getall()
The above code returns:
['Text1', 'Text2', 'Text3']
['Text1', 'Text2', 'Text3']
['Text1', 'Text2', 'Text3']
While my expected output would be:
['Text1']
['Text2']
['Text3']
What am i not getting? This kind of iteration in vertical while i would like to iterate overt the response in a horizontal manner.
Why not just use css selector for strong tags with child a tags?
.css("strong a").getall()
You should probably add the id
#titlo strong a
For xpath
//*[#id='titlo']/strong/a

URL Readable by urllib in Python 2 but not in Python 3

I can read a specific web page in Python2 quite easily:
>>> import urllib
>>> urllib.urlopen("http://www.pluralsight.com/authors")
<addinfourl at 4566566312 whose fp = <socket._fileobject object at 0x10fd18a50>>
When I try to read the same URL using Python3, however, I get an exception:
>>> from urllib.request import urlopen
>>> urlopen("http://www.pluralsight.com/authors")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 499, in error
return self._call_chain(*args)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
>>>
In Python 3, urllib.request.urlopen is equivalent to Python2's urllib2.urlopen, and urllib.urlopen has been removed.
You can see the differences and why you're getting an error in Python 3 in this SO question. Basically, urllib2.urlopen (urllib.request.urlopen in Python 3) handles the error for you, raising an exception, while urllib.urlopen just gives you the error as plain HTML.
Hope it helps.
It seems like it wasn't working in Python2 either:
u = urllib.urlopen("http://www.pluralsight.com/authors")
u.read()
#'<html><body><h1>403 Forbidden</h1>\nRequest
#forbidden by administrative rules.\n</body></html>\n\n'
You need to add a user-agent:
import urllib
req = urllib.request.Request(
"http://www.pluralsight.com/authors",
headers={
'User-Agent': 'Mozilla/5.0'
}
)
print(urllib.request.urlopen(req).read())
b'<!DOCTYPE html>\r\n<!--[if IE 8]>\r\n <html class="no-js lt-ie9" lang="en" ng-app="pluralsightModule">\r\n<![endif]-->\r\n<!--[if gt IE 8]><!-->\r\n<html class="no-js" lang="en" ng-app="pluralsightModule" id="ng-app">\r\n<!--<![endif]-->\r\n<head>\r\n <meta charset="utf-8" http-equiv="Content-type" content="text/html;" /><script type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"2700af8a3c","applicationID":"3058581","transactionName":"Z1ZRN0EDCEMDABVYWl4cdwxHLANEIQwPRUdfX18GQU0nRRYLDkNGH3pdB1Ya","queueTime":0,"applicationTime":3,"ttGuid":"88B4BF5354B4582F","agent":"js-agent.newrelic.com/nr-593.min.js"}</script><script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VwUGVl5VGwAAUVlXDwA="};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o?o:e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({QJf3ax:[function(t,e){function n(t){function e(e,n,a){t&&t(e,n,a),a||(a={});for(var c=s(e),f=c.length,u=i(a,o,r),d=0;f>d;d++)c[d].apply(u,n);return u}function a(t,e){f[t]=s(t).concat(e)}function s(t){return f[t]||[]}function c(){return n(e)}var f={};return{on:a,emit:e,create:c,listeners:s,_events:f}}function r(){return{}}var o="nr#context",i=t("gos");e.exports=n()},{gos:"7eSDFh"}],ee:[function(t,e){e.exports=t("QJf3ax")},{}],3:[function(t){function e(t){try{i.console&&console.log(t)}catch(e){}}var n,r=t("ee"),o=t(1),i={};try{n=localStorage.getItem("__nr_flags").split(","),console&&"function"==typeof console.log&&(i.console=!0,-1!==n.indexOf("dev")&&(i.dev=!0),-1!==n.indexOf("nr_dev")&&(i.nrDev=!0))}catch(a){}i.nrDev&&r.on("internal-error",function(t){e(t.stack)}),i.dev&&r.on("fn-err",function(t,n,r){e(r.stack)}),i.dev&&(e("NR AGENT IN DEVELOPMENT MODE"),e("flags: "+o(i,function(t){return t}).join(", ")))},{1:23,ee:"QJf3ax"}],4:[function(t){function e(t,e,n,i,s){try{c?c-=1:r("err",[s||new UncaughtException(t,e,n)])}catch(f){try{r("ierr",[f,(new Date).getTime(),!0])}catch(u){}}return"function"==typeof a?a.apply(this,o(arguments)):!1}function UncaughtException(t,e,n){this.message=t||"Uncaught error with no additional information",this.sourceURL=e,this.line=n}function n(t){r("err",[t,(new Date).getTime()])}var r=t("handle"),o=t(6),i=t("ee"),a=window.onerror,s=!1,c=0;t("loader").features.err=!0,t(4),window.onerror=e;try{throw new Error}catch(f){"stack"in f&&(t(1),t(5),"addEventListener"in window&&t(2),window.XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.addEventListener&&t(3),s=!0)}i.on("fn-start",function(){s&&(c+=1)}),i.on("fn-err",function(t,e,r){s&&(this.thrown=!0,n(r))}),i.on("fn-end",function(){s&&!this.thrown&&c>0&&(c-=1)}),i.on("internal-error",function(t){r("ierr",[t,(new Date).getTime(),!0])})},{1:10,2:7,3:11,4:3,5:9,6:24,ee:"QJf3ax",handle:"D5DuLP",loader:"G9z0Bl"}],5:[function(t){t("loader").features.ins=!0},{loader:"G9z0Bl"}],6:[function(t){function e(){}if(window.performance&&window.performance.timing&&window.performance.getEntriesByType){var n=t("ee"),r=t("handle"),o=t(1);t("loader").features.stn=!0,t(2),n.on("fn-start",function(t){var e=t[0];e instanceof Event&&(this.bstStart=Date.now())}),n.on("fn-end",function(t,e){var n=t[0];n instanceof Event&&r("bst",[n,e,this.bstStart,Date.now()])}),o.on("fn-start",function(t,e,n){this.bstStart=Date.now(),this.bstType=n}),o.on("fn-end",function(t,e){r("bstTimer",[e,this.bstStart,Date.now(),this.bstType])}),n.on("pushState-start",function(){this.time=Date.now(),this.startPath=location.pathname+location.hash}),n.on("pushState-end",function(){r("bstHist",[location.pathname+location.hash,this.startPath,this.time])}),"addEventListener"in window.performance&&(window.performance.addEventListener("webkitresourcetimingbufferfull",function(){r("bstResource",[window.performance.getEntriesByType("resource")]),window.performance.webkitClearResourceTimings()},!1),window.performance.addEventListener("resourcetimingbufferfull",function(){r("bstResource",[window.performance.getEntriesByType("resource")]),window.performance.clearResourceTimings()},!1)),document.addEventListener("scroll",e,!1),document.addEventListener("keypress",e,!1),document.addEventListener("click",e,!1)}},{1:10,2:8,ee:"QJf3ax",handle:"D5DuLP",loader:"G9z0Bl"}],7:[function(t,e){function n(t){i.inPlace(t,["addEventListener","removeEventListener"],"-",r)}function r(t){return t[1]}var o=(t(1),t("ee").create()),i=t(2)(o),a=t("gos");if(e.exports=o,n(window),"getPrototypeOf"in Object){for(var s=document;s&&!s.hasOwnProperty("addEventListener");)s=Object.getPrototypeOf(s);s&&n(s);for(var c=XMLHttpRequest.prototype;c&&!c.hasOwnProperty("addEventListener");)c=Object.getPrototypeOf(c);c&&n(c)}else XMLHttpRequest.prototype.hasOwnProperty("addEventListener")&&n(XMLHttpRequest.prototype);o.on("addEventListener-start",function(t){if(t[1]){var e=t[1];"function"==typeof e?this.wrapped=t[1]=a(e,"nr#wrapped",function(){return i(e,"fn-",null,e.name||"anonymous")}):"function"==typeof e.handleEvent&&i.inPlace(e,["handleEvent"],"fn-")}}),o.on("removeEventListener-start",function(t){var e=this.wrapped;e&&(t[1]=e)})},{1:24,2:25,ee:"QJf3ax",gos:"7eSDFh"}],8:[function(t,e){var n=(t(2),t("ee").create()),r=t(1)(n);e.exports=n,r.inPlace(window.history,["pushState"],"-")},{1:25,2:24,ee:"QJf3ax"}],9:[function(t,e){var n=(t(2),t("ee").create()),r=t(1)(n);e.exports=n,r.inPlace(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame"],"raf-"),n.on("raf-start",function(t){t[0]=r(t[0],"fn-")})},{1:25,2:24,ee:"QJf3ax"}],10:[function(t,e){function n(t,e,n){var r=t[0];"string"==typeof r&&(r=new Function(r)),t[0]=o(r,"fn-",null,n)}var r=(t(2),t("ee").create()),o=t(1)(r);e.exports=r,o.inPlace(window,["setTimeout","setInterval","setImmediate"],"setTimer-"),r.on("setTimer-start",n)},{1:25,2:24,ee:"QJf3ax"}],11:[function(t,e){function n(){f.inPlace(this,p,"fn-")}function r(t,e){f.inPlace(e,["onreadystatechange"],"fn-")}function o(t,e){return e}function i(t,e){for(var n in t)e[n]=t[n];return e}var a=t("ee").create(),s=t(1),c=t(2),f=c(a),u=c(s),d=window.XMLHttpRequest,p=["onload","onerror","onabort","onloadstart","onloadend","onprogress","ontimeout"];e.exports=a,window.XMLHttpRequest=function(t){var e=new d(t);try{a.emit("new-xhr",[],e),u.inPlace(e,["addEventListener","removeEventListener"],"-",function(t,e){return e}),e.addEventListener("readystatechange",n,!1)}catch(r){try{a.emit("internal-error",[r])}catch(o){}}return e},i(d,XMLHttpRequest),XMLHttpRequest.prototype=d.prototype,f.inPlace(XMLHttpRequest.prototype,["open","send"],"-xhr-",o),a.on("send-xhr-start",r),a.on("open-xhr-start",r)},{1:7,2:25,ee:"QJf3ax"}],12:[function(t){function e(t){if("string"==typeof t&&t.length)return t.length;if("object"!=typeof t)return void 0;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer&&t.byteLength)return t.byteLength;if("undefined"!=typeof Blob&&t instanceof Blob&&t.size)return t.size;if("undefined"!=typeof FormData&&t instanceof FormData)return void 0;try{return JSON.stringify(t).length}catch(e){return void 0}}function n(t){var n=this.params,r=this.metrics;if(!this.ended){this.ended=!0;for(var i=0;c>i;i++)t.removeEventListener(s[i],this.listener,!1);if(!n.aborted){if(r.duration=(new Date).getTime()-this.startTime,4===t.readyState){n.status=t.status;var a=t.responseType,f="arraybuffer"===a||"blob"===a||"json"===a?t.response:t.responseText,u=e(f);if(u&&(r.rxSize=u),this.sameOrigin){var d=t.getResponseHeader("X-NewRelic-App-Data");d&&(n.cat=d.split(", ").pop())}}else n.status=0;r.cbTime=this.cbTime,o("xhr",[n,r,this.startTime])}}}function r(t,e){var n=i(e),r=t.params;r.host=n.hostname+":"+n.port,r.pathname=n.pathname,t.sameOrigin=n.sameOrigin}if(window.XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.addEventListener&&!/CriOS/.test(navigator.userAgent)){t("loader").features.xhr=!0;var o=t("handle"),i=t(2),a=t("ee"),s=["load","error","abort","timeout"],c=s.length,f=t(1);t(4),t(3),a.on("new-xhr",function(){this.totalCbs=0,this.called=0,this.cbTime=0,this.end=n,this.ended=!1,this.xhrGuids={}}),a.on("open-xhr-start",function(t){this.params={method:t[0]},r(this,t[1]),this.metrics={}}),a.on("open-xhr-end",function(t,e){"loader_config"in NREUM&&"xpid"in NREUM.loader_config&&this.sameOrigin&&e.setRequestHeader("X-NewRelic-ID",NREUM.loader_config.xpid)}),a.on("send-xhr-start",function(t,n){var r=this.metrics,o=t[0],i=this;if(r&&o){var f=e(o);f&&(r.txSize=f)}this.startTime=(new Date).getTime(),this.listener=function(t){try{"abort"===t.type&&(i.params.aborted=!0),("load"!==t.type||i.called===i.totalCbs&&(i.onloadCalled||"function"!=typeof n.onload))&&i.end(n)}catch(e){try{a.emit("internal-error",[e])}catch(r){}}};for(var u=0;c>u;u++)n.addEventListener(s[u],this.listener,!1)}),a.on("xhr-cb-time",function(t,e,n){this.cbTime+=t,e?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&"function"==typeof n.onload||this.end(n)}),a.on("xhr-load-added",function(t,e){var n=""+f(t)+!!e;this.xhrGuids&&!this.xhrGuids[n]&&(this.xhrGuids[n]=!0,this.totalCbs+=1)}),a.on("xhr-load-removed",function(t,e){var n=""+f(t)+!!e;this.xhrGuids&&this.xhrGuids[n]&&(delete this.xhrGuids[n],this.totalCbs-=1)}),a.on("addEventListener-end",function(t,e){e instanceof XMLHttpRequest&&"load"===t[0]&&a.emit("xhr-load-added",[t[1],t[2]],e)}),a.on("removeEventListener-end",function(t,e){e instanceof XMLHttpRequest&&"load"===t[0]&&a.emit("xhr-load-removed",[t[1],t[2]],e)}),a.on("fn-start",function(t,e,n){e instanceof XMLHttpRequest&&("onload"===n&&(this.onload=!0),("load"===(t[0]&&t[0].type)||this.onload)&&(this.xhrCbStart=(new Date).getTime()))}),a.on("fn-end",function(t,e){this.xhrCbStart&&a.emit("xhr-cb-time",[(new Date).getTime()-this.xhrCbStart,this.onload,e],e)})}},{1:"XL7HBI",2:13,3:11,4:7,ee:"QJf3ax",handle:"D5DuLP",loader:"G9z0Bl"}],13:[function(t,e){e.exports=function(t){var e=document.createElement("a"),n=window.location,r={};e.href=t,r.port=e.port;var o=e.href.split("://");return!r.port&&o[1]&&(r.port=o[1].split("/")[0].split("#").pop().split(":")[1]),r.port&&"0"!==r.port||(r.port="https"===o[0]?"443":"80"),r.hostname=e.hostname||n.hostname,r.pathname=e.pathname,r.protocol=o[0],"/"!==r.pathname.charAt(0)&&(r.pathname="/"+r.pathname),r.sameOrigin=!e.hostname||e.hostname===document.domain&&e.port===n.port&&e.protocol===n.protocol,r}},{}],14:[function(t,e){function n(t){return function(){r(t,[(new Date).getTime()].concat(i(arguments)))}}var r=t("handle"),o=t(1),i=t(2);"undefined"==typeof window.newrelic&&(newrelic=window.NREUM);var a=["setPageViewName","addPageAction","setCustomAttribute","finished","addToTrace","inlineHit","noticeError"];o(a,function(t,e){window.NREUM[e]=n("api-"+e)}),e.exports=window.NREUM},{1:23,2:24,handle:"D5DuLP"}],gos:[function(t,e){e.exports=t("7eSDFh")},{}],"7eSDFh":[function(t,e){function n(t,e,n){if(r.call(t,e))return t[e];var o=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:o,writable:!0,enumerable:!1}),o}catch(i){}return t[e]=o,o}var r=Object.prototype.hasOwnProperty;e.exports=n},{}],D5DuLP:[function(t,e){function n(t,e,n){return r.listeners(t).length?r.emit(t,e,n):(o[t]||(o[t]=[]),void o[t].push(e))}var r=t("ee").create(),o={};e.exports=n,n.ee=r,r.q=o},{ee:"QJf3ax"}],handle:[function(t,e){e.exports=t("D5DuLP")},{}],XL7HBI:[function(t,e){function n(t){var e=typeof t;return!t||"object"!==e&&"function"!==e?-1:t===window?0:i(t,o,function(){return r++})}var r=1,o="nr#id",i=t("gos");e.exports=n},{gos:"7eSDFh"}],id:[function(t,e){e.exports=t("XL7HBI")},{}],loader:[function(t,e){e.exports=t("G9z0Bl")},{}],G9z0Bl:[function(t,e){function n(){var t=l.info=NREUM.info;if(t&&t.licenseKey&&t.applicationID&&f&&f.body){s(h,function(e,n){e in t||(t[e]=n)}),l.proto="https"===p.split(":")[0]||t.sslForHttp?"https://":"http://",a("mark",["onload",i()]);var e=f.createElement("script");e.src=l.proto+t.agent,f.body.appendChild(e)}}function r(){"complete"===f.readyState&&o()}function o(){a("mark",["domContent",i()])}function i(){return(new Date).getTime()}var a=t("handle"),s=t(1),c=(t(2),window),f=c.document,u="addEventListener",d="attachEvent",p=(""+location).split("?")[0],h={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",agent:"js-agent.newrelic.com/nr-593.min.js"},l=e.exports={offset:i(),origin:p,features:{}};f[u]?(f[u]("DOMContentLoaded",o,!1),c[u]("load",n,!1)):(f[d]("onreadystatechange",r),c[d]("onload",n)),a("mark",["firstbyte",i()])},{1:23,2:14,handle:"D5DuLP"}],23:[function(t,e){function n(t,e){var n=[],o="",i=0;for(o in t)r.call(t,o)&&(n[i]=e(o,t[o]),i+=1);return n}var r=Object.prototype.hasOwnProperty;e.exports=n},{}],24:[function(t,e){function n(t,e,n){e||(e=0),"undefined"==typeof n&&(n=t?t.length:0);for(var r=-1,o=n-e||0,i=Array(0>o?0:o);++r<o;)i[r]=t[e+r];return i}e.exports=n},{}],25:[function(t,e){function n(t){return!(t&&"function"==typeof t&&t.apply&&!t[i])}var r=t("ee"),o=t(1),i="nr#wrapper",a=Object.prototype.hasOwnProperty;e.exports=function(t){function e(t,e,r,a){function nrWrapper(){var n,i,s,f;try{i=this,n=o(arguments),s=r&&r(n,i)||{}}catch(d){u([d,"",[n,i,a],s])}c(e+"start",[n,i,a],s);try{return f=t.apply(i,n)}catch(p){throw c(e+"err",[n,i,p],s),p}finally{c(e+"end",[n,i,f],s)}}return n(t)?t:(e||(e=""),nrWrapper[i]=!0,f(t,nrWrapper),nrWrapper)}function s(t,r,o,i){o||(o="");var a,s,c,f="-"===o.charAt(0);for(c=0;c<r.length;c++)s=r[c],a=t[s],n(a)||(t[s]=e(a,f?s+o:o,i,s,t))}function c(e,n,r){try{t.emit(e,n,r)}catch(o){u([o,e,n,r])}}function f(t,e){if(Object.defineProperty&&Object.keys)try{var n=Object.keys(t);return n.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(r){u([r])}for(var o in t)a.call(t,o)&&(e[o]=t[o]);return e}function u(e){try{t.emit("internal-error",e)}catch(n){}}return t||(t=r),e.inPlace=s,e.flag=i,e}},{1:24,ee:"QJf3ax"}]},{},["G9z0Bl",4,12,6,5]);</script>\r\n <meta name="viewport" content="width=device-width" />\r\n <meta name="fragment" content="!" />\r\n <title>Authors \xe2\x80\x93 Pluralsight Training</title>\r\n <link rel="stylesheet" href="//s.pluralsight.com/sc/css/app-a7dac6e6.css" />\r\n <link rel="stylesheet" href="//www.pluralsight.com/content/dist/css/fonts-a9675ca7.css" />\r\n <link href=\'//fonts.googleapis.com/css?family=Open+Sans:100,200,300,400,500,600,700,800,900\' rel=\'stylesheet\' type=\'text/css\'>\r\n <!--[if lte IE 9]>\r\n <link rel="stylesheet" href="//s.pluralsight.com/sc/css/ie-app-1bed8c68.css" />\r\n <![endif]-->\r\n <!--[if IE 8]>\r\n <link rel="stylesheet" href="//s.pluralsight.com/sc/css/ie8-62d3a852.css" />\r\n <![endif]-->\r\n <!--[if IE]>\r\n <link rel="stylesheet" href="//s.pluralsight.com/sc/css/ie-7dd5dc87.css" />\r\n <![endif]-->\r\n\r\n <script src="//s.pluralsight.com/sc/js/vendor/custom.modernizr-b4b7741a.js"></script>\r\n\r\n \r\n \r\n \r\n <script src="//cdn.optimizely.com/js/1252788015.js"></script>\r\n\r\n</head>\r\n<body>\r\n <!-- Google Tag Manager -->\r\n<noscript>\r\n <iframe src="//www.googletagmanager.com/ns.html?id=GTM-MNK9CB" height="0" width="0" style="display:none;visibility:hidden"></iframe>\r\n</noscript>\r\n<script>\r\n (function (w, d, s, l, i) {\r\n w[l] = w[l] || [];\r\n w[l].push({ \'gtm.start\': new Date().getTime(), event: \'gtm.js\' });\r\n var f = d.getElementsByTagName(s)[0],\r\n j = d.createElement(s),\r\n dl = l != \'dataLayer\' ? \'&l=\' + l : \'\';\r\n j.async = true;\r\n j.src = \'//www.googletagmanager.com/gtm.js?id=\' + i + dl;\r\n f.parentNode.insertBefore(j, f);\r\n })(window, document, \'script\', \'dataLayer\', \'GTM-MNK9CB\');\r\n</script>\r\n<!-- End Google Tag Manager -->\r\n\r\n <input type="hidden" id="pageObjectTag" value="AuthorsPage" />\r\n <div ng-controller="AuthenticationController">\r\n <div ng-include src="\'/header\'"></div>\r\n\r\n \r\n\r\n<!-- HERO UNIT -->\r\n<section class="teal-hex-bg hero">\r\n <div class="row">\r\n <div class="small-12 columns">\r\n <h1 class="medium">Our authors</h1>\r\n <h4 class="normal">Our original courses are authored by an elite group of tech and creative professionals, innovators and leaders. We take pride in only working with the best.</h4>\r\n <h5 class="authors-invite-to-teach"><strong>Want to join us?</strong></h5>\r\n <a class="teal button" href="/teach">Learn more</a>\r\n </div>\r\n </div>\r\n</section><!-- /HERO UNIT -->\r\n<!-- SECTION TITLE -->\r\n<section class="band" ng-controller="AuthorsController">\r\n\r\n <div class="row">\r\n <div class="small-12 columns">\r\n <div loading show="loading"></div>\r\n <div class="author-group" ng-cloak ng-repeat="(key, value) in authors">\r\n <p class="underline">{{key.toUpperCase()}}</p>\r\n <ul class="inline-list" >\r\n <li ng-repeat="author in value"><a class="panel" ng-href="/author/{{author.handle}}">{{author.fullName}}</a></li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</section>\r\n\r\n </div>\r\n <footer ng-controller="FooterController">\r\n <div class="row">\r\n <!-- MAIN FOOTER STUFF -->\r\n <div class="large-4 columns">\r\n <img src="//s.pluralsight.com/sc/img/layout/logo-grey-v3.png" class="secondary-logo" />\r\n <p>\r\n Our mission is to publish high quality online training courses for professional developers, IT admins and creative artists. Every day.\r\n </p>\r\n <!-- facebook -->\r\n <a class="facebook social button" href="http://www.facebook.com/pluralsight" target="_blank" rel="nofollow">\r\n <span class="icon">\r\n <i class="social fi-social-facebook"></i>\r\n </span>\r\n Facebook\r\n <span ng-class="{\'number\': social.likes != undefined}" ng-cloak>{{social.likes | number}}</span>\r\n </a>\r\n <!-- twitter -->\r\n <a class="twitter social button" href="http://twitter.com/pluralsight" target="_blank" rel="nofollow">\r\n <span class="icon">\r\n <i class="social fi-social-twitter"></i>\r\n </span>\r\n Twitter\r\n <span ng-class="{\'number\': social.followers != undefined}" ng-cloak>{{social.followers | number}}</span>\r\n </a>\r\n <!-- google+ -->\r\n <a class="google social button" href="http://plus.google.com/+pluralsight" target="_blank" rel="nofollow">\r\n <span class="icon">\r\n <i class="social fi-social-google-plus"></i>\r\n </span>\r\n Google+\r\n <span ng-class="{\'number\': social.plusOnes != undefined}" ng-cloak>{{social.plusOnes | number}}</span>\r\n </a>\r\n <!-- newsletter -->\r\n <p>Subscribe to our newsletter for weekly updates.</p>\r\n <div class="row collapse signup-form">\r\n <form action="https://go.pardot.com/l/36882/2014-08-27/yj3h" method="POST">\r\n <div class="small-8 columns">\r\n <input type="text" placeholder="Email" name="UserInfo.Email" ng-focus="newsletterEmailFocus()" />\r\n </div>\r\n <div class="small-4 columns">\r\n <input class="button postfix" type="submit" name="submit" value="Submit">\r\n </div>\r\n </form>\r\n\r\n </div>\r\n </div>\r\n <!-- SITE MAP -->\r\n <div class="large-7 large-offset-1 columns">\r\n <div class="row">\r\n <div class="large-4 columns">\r\n <h5>Learn</h5>\r\n <ul class="side-nav">\r\n <li>Browse Courses</li>\r\n <li>Learning Paths</li>\r\n </ul>\r\n <h5>Products</h5>\r\n <ul class="side-nav">\r\n <li>Individual Plans</li>\r\n <li>Business Plans</li>\r\n <li>Free Trial</li>\r\n <li>Academic</li>\r\n <li>Government</li>\r\n </ul>\r\n </div>\r\n <div class="large-4 columns">\r\n <h5>Community</h5>\r\n <ul class="side-nav">\r\n <li>Free Kids Courses</li>\r\n <li>Official Blog</li>\r\n <li>Study Groups</li>\r\n <li>UG & Event Sponsorships</li>\r\n </ul>\r\n <h5>Support</h5>\r\n <ul class="side-nav">\r\n <li>Ask Support a Question</li>\r\n <li>Suggest a Course</li>\r\n <li>Support & Feedback</li>\r\n <li>Knowledge Base / FAQ</li>\r\n <li>Terms of Use</li>\r\n </ul>\r\n </div>\r\n <div class="large-4 columns">\r\n <h5>Features</h5>\r\n <ul class="side-nav">\r\n <li>Mobile Apps</li>\r\n <li>Offline Viewing</li>\r\n </ul>\r\n <h5>About</h5>\r\n <ul class="side-nav">\r\n <li>Contact Us</li>\r\n <li>Press Center</li>\r\n <li>About Us</li>\r\n <li>Authors</li>\r\n <li>Teach</li>\r\n <li>Jobs at Pluralsight</li>\r\n </ul>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </footer>\r\n\r\n <script src="//s.pluralsight.com/sc/js/bundled/vendor-46f7b492.js"></script>\r\n <script src="//s.pluralsight.com/sc/js/bundled/app-d238c035.js"></script>\r\n\r\n\r\n <script type="text/javascript">\r\n pluralsightModule.factory(\'baseUrls\', function () {\r\n return {\r\n dataUrl: \'/data\',\r\n mvcUrl: \'//www.pluralsight.com/a\',\r\n mainWebUrl: \'//www.pluralsight.com/training\',\r\n staticCdnUrl: \'http://s.pluralsight.com\',\r\n staticUrl: \'//www.pluralsight.com\',\r\n contentUrl: \'//s.pluralsight.com/sc\'\r\n };\r\n })\r\n .factory(\'validationService\', function () {\r\n return {\r\n emailAddressPattern: \'/^[a-zA-Z0-9'._%+-]+#[a-zA-Z0-9-][a-zA-Z0-9.-]*\\.[a-zA-Z]{2,63}$/\'\r\n };\r\n })\r\n .factory(\'settingsProvider\', function ($resource) {\r\n return {\r\n featureToggleMarketoFormHandlers: String(false) == \'true\',\r\n featureToggleLinkedIn: String(false) == \'true\'\r\n };\r\n });\r\n \r\n\r\n </script>\r\n\r\n <script type="text/javascript">\r\n var hero = $(".hero") || $("header");\r\n hero.after(\'<div class="global-message-bar" ng-cloak ng-controller="MessageBarController" ng-show="hasMessage()"><div class="row"><div class="small-12 columns"><i class="fi-x"></i><span class="message-text">{{getMessage()}}</span></div></div></div>\');\r\n </script>\r\n\r\n \r\n</body>\r\n</html>\r\n'
Or use requests:
import requests
r = requests.get("http://www.pluralsight.com/authors")
print(r.content)

Categories

Resources