Error “Failed processing Browscap file” python webscraping
I am trying to create a program which will access a specific https webpage on my university website in which my semester marks are displayed. I want to scrape the web page to check for changes to when my final marks come out and then send an email to myself (easier than having to check at random throughout the day).
I've never done web scraping before and the site requires login authentication so this problem is probably more complicated than I think but here is what I have so far:
import certifi
from bs4 import BeautifulSoup
import urllib3 as u
url = "https://upnet.up.ac.za/psc/pscsmpra/EMPLOYEE/SA/c/UP_SS_MENU.UP_SS_RESULTS_FL.GBL"
http = u.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
try:
r = http.request('GET',url,timeout=u.Timeout(connect=1.0, read=2.0))
except u.exceptions.NewConnectionError:
print("Connection Failed")
print(r.status)
soup = BeautifulSoup(r.data,features="html.parser")
print(soup.prettify())
running this code returns the following:
200
Failed processing Browscap file. as it could be missing. Please
contact your system adminstrator.
If i run r.headers i get this:
HTTPHeaderDict({'Date': 'Thu, 15 Nov 2018 07:13:27 GMT', 'Server':
'Apache', 'Content-Length': '99', 'X-Frame-Options': 'SAMEORIGIN',
'Set-Cookie':
'appcsmpr08-7007-PORTAL-PSJSESSIONID=5T8WMyIf2lC2ZSBTaf84UZBA-tV9BLAh!631984709;
domain=.up.ac.za; path=/; HttpOnly,
NSC_wt_dbnqvtqspe=ffffffff8adf14db45525d5f4f58455e445a4a422d6f;expires=Thu,
15-Nov-2018 08:09:29 GMT;path=/;httponly,
dtCookie=E2152DB7F41B75674D0AE5146876F0EB|UFNDU018MQ; Path=/;
Domain=.up.ac.za', 'X-Clacks-Overhead': 'GNU Terry Pratchett',
'Content-Type': 'text/plain; charset=UTF-8'}) PS
C:UsersShaunDocumentsPersonal_ProjectsmarkAlert>
I assume that I'm able to connect but I'm uncertain of what is meant by the error above. A google search was no help.
Any help on how to fix this appreciated!
python web-scraping beautifulsoup urllib3
add a comment |
I am trying to create a program which will access a specific https webpage on my university website in which my semester marks are displayed. I want to scrape the web page to check for changes to when my final marks come out and then send an email to myself (easier than having to check at random throughout the day).
I've never done web scraping before and the site requires login authentication so this problem is probably more complicated than I think but here is what I have so far:
import certifi
from bs4 import BeautifulSoup
import urllib3 as u
url = "https://upnet.up.ac.za/psc/pscsmpra/EMPLOYEE/SA/c/UP_SS_MENU.UP_SS_RESULTS_FL.GBL"
http = u.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
try:
r = http.request('GET',url,timeout=u.Timeout(connect=1.0, read=2.0))
except u.exceptions.NewConnectionError:
print("Connection Failed")
print(r.status)
soup = BeautifulSoup(r.data,features="html.parser")
print(soup.prettify())
running this code returns the following:
200
Failed processing Browscap file. as it could be missing. Please
contact your system adminstrator.
If i run r.headers i get this:
HTTPHeaderDict({'Date': 'Thu, 15 Nov 2018 07:13:27 GMT', 'Server':
'Apache', 'Content-Length': '99', 'X-Frame-Options': 'SAMEORIGIN',
'Set-Cookie':
'appcsmpr08-7007-PORTAL-PSJSESSIONID=5T8WMyIf2lC2ZSBTaf84UZBA-tV9BLAh!631984709;
domain=.up.ac.za; path=/; HttpOnly,
NSC_wt_dbnqvtqspe=ffffffff8adf14db45525d5f4f58455e445a4a422d6f;expires=Thu,
15-Nov-2018 08:09:29 GMT;path=/;httponly,
dtCookie=E2152DB7F41B75674D0AE5146876F0EB|UFNDU018MQ; Path=/;
Domain=.up.ac.za', 'X-Clacks-Overhead': 'GNU Terry Pratchett',
'Content-Type': 'text/plain; charset=UTF-8'}) PS
C:UsersShaunDocumentsPersonal_ProjectsmarkAlert>
I assume that I'm able to connect but I'm uncertain of what is meant by the error above. A google search was no help.
Any help on how to fix this appreciated!
python web-scraping beautifulsoup urllib3
add a comment |
I am trying to create a program which will access a specific https webpage on my university website in which my semester marks are displayed. I want to scrape the web page to check for changes to when my final marks come out and then send an email to myself (easier than having to check at random throughout the day).
I've never done web scraping before and the site requires login authentication so this problem is probably more complicated than I think but here is what I have so far:
import certifi
from bs4 import BeautifulSoup
import urllib3 as u
url = "https://upnet.up.ac.za/psc/pscsmpra/EMPLOYEE/SA/c/UP_SS_MENU.UP_SS_RESULTS_FL.GBL"
http = u.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
try:
r = http.request('GET',url,timeout=u.Timeout(connect=1.0, read=2.0))
except u.exceptions.NewConnectionError:
print("Connection Failed")
print(r.status)
soup = BeautifulSoup(r.data,features="html.parser")
print(soup.prettify())
running this code returns the following:
200
Failed processing Browscap file. as it could be missing. Please
contact your system adminstrator.
If i run r.headers i get this:
HTTPHeaderDict({'Date': 'Thu, 15 Nov 2018 07:13:27 GMT', 'Server':
'Apache', 'Content-Length': '99', 'X-Frame-Options': 'SAMEORIGIN',
'Set-Cookie':
'appcsmpr08-7007-PORTAL-PSJSESSIONID=5T8WMyIf2lC2ZSBTaf84UZBA-tV9BLAh!631984709;
domain=.up.ac.za; path=/; HttpOnly,
NSC_wt_dbnqvtqspe=ffffffff8adf14db45525d5f4f58455e445a4a422d6f;expires=Thu,
15-Nov-2018 08:09:29 GMT;path=/;httponly,
dtCookie=E2152DB7F41B75674D0AE5146876F0EB|UFNDU018MQ; Path=/;
Domain=.up.ac.za', 'X-Clacks-Overhead': 'GNU Terry Pratchett',
'Content-Type': 'text/plain; charset=UTF-8'}) PS
C:UsersShaunDocumentsPersonal_ProjectsmarkAlert>
I assume that I'm able to connect but I'm uncertain of what is meant by the error above. A google search was no help.
Any help on how to fix this appreciated!
python web-scraping beautifulsoup urllib3
I am trying to create a program which will access a specific https webpage on my university website in which my semester marks are displayed. I want to scrape the web page to check for changes to when my final marks come out and then send an email to myself (easier than having to check at random throughout the day).
I've never done web scraping before and the site requires login authentication so this problem is probably more complicated than I think but here is what I have so far:
import certifi
from bs4 import BeautifulSoup
import urllib3 as u
url = "https://upnet.up.ac.za/psc/pscsmpra/EMPLOYEE/SA/c/UP_SS_MENU.UP_SS_RESULTS_FL.GBL"
http = u.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
try:
r = http.request('GET',url,timeout=u.Timeout(connect=1.0, read=2.0))
except u.exceptions.NewConnectionError:
print("Connection Failed")
print(r.status)
soup = BeautifulSoup(r.data,features="html.parser")
print(soup.prettify())
running this code returns the following:
200
Failed processing Browscap file. as it could be missing. Please
contact your system adminstrator.
If i run r.headers i get this:
HTTPHeaderDict({'Date': 'Thu, 15 Nov 2018 07:13:27 GMT', 'Server':
'Apache', 'Content-Length': '99', 'X-Frame-Options': 'SAMEORIGIN',
'Set-Cookie':
'appcsmpr08-7007-PORTAL-PSJSESSIONID=5T8WMyIf2lC2ZSBTaf84UZBA-tV9BLAh!631984709;
domain=.up.ac.za; path=/; HttpOnly,
NSC_wt_dbnqvtqspe=ffffffff8adf14db45525d5f4f58455e445a4a422d6f;expires=Thu,
15-Nov-2018 08:09:29 GMT;path=/;httponly,
dtCookie=E2152DB7F41B75674D0AE5146876F0EB|UFNDU018MQ; Path=/;
Domain=.up.ac.za', 'X-Clacks-Overhead': 'GNU Terry Pratchett',
'Content-Type': 'text/plain; charset=UTF-8'}) PS
C:UsersShaunDocumentsPersonal_ProjectsmarkAlert>
I assume that I'm able to connect but I'm uncertain of what is meant by the error above. A google search was no help.
Any help on how to fix this appreciated!
python web-scraping beautifulsoup urllib3
python web-scraping beautifulsoup urllib3
edited Nov 15 '18 at 8:43
Blargian
asked Nov 15 '18 at 7:11
BlargianBlargian
124
124
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
the error came from the server because cannot detect your request user-agent, set it.
heads = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0'}
http = u.PoolManager(headers=heads)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314141%2ferror-failed-processing-browscap-file-python-webscraping%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
the error came from the server because cannot detect your request user-agent, set it.
heads = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0'}
http = u.PoolManager(headers=heads)
add a comment |
the error came from the server because cannot detect your request user-agent, set it.
heads = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0'}
http = u.PoolManager(headers=heads)
add a comment |
the error came from the server because cannot detect your request user-agent, set it.
heads = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0'}
http = u.PoolManager(headers=heads)
the error came from the server because cannot detect your request user-agent, set it.
heads = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0'}
http = u.PoolManager(headers=heads)
answered Nov 15 '18 at 15:34
ewwinkewwink
12k22439
12k22439
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314141%2ferror-failed-processing-browscap-file-python-webscraping%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown