May-29-2020, 08:46 AM
Hello guys,
I am learning python. Now I am at stage to use urllib.request.urlopen.
The code from py4e:
Scenario 2: Proxy and VPN: I am not getting the romeo.txt content. I am getting proxy warning:
1. Can you advise why the same content is accessible via webrowser with proxy but the same content is not read by simple python script ?
2. Can you advice how to overcome this issue ?
Thank you.
I am learning python. Now I am at stage to use urllib.request.urlopen.
The code from py4e:
import urllib.request, urllib.parse, urllib.error fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt') for line in fhand: print(line.decode().strip())Scenario 1: No proxy, no VPN = the code works well.
Scenario 2: Proxy and VPN: I am not getting the romeo.txt content. I am getting proxy warning:
Error:</script>
<div id="wrap">
<div class="container">
<div class="row">
<!-- main content -->
<div class="col-md-12" id="main-col">
<div class="page-header">
<div style="text-align: center">
<h1>Oops! Your web browser has incurred an unexpected error.</h1>
<h1>Please close your browser and try again</h1>
</div>
</div>
<div class="panel-body">
<p class="strong">If this problem persists please review the following support options for further assistance:</p>
<div id="list0">
<br>
<ol>
<li>
However, when entering http://data.pr4e.org/romeo.txt into browser (FF, Chrome)using the same proxy, the content is displayed in webbrowser.1. Can you advise why the same content is accessible via webrowser with proxy but the same content is not read by simple python script ?
2. Can you advice how to overcome this issue ?
Thank you.