Questions tagged [urlopen]

The urlopen is a method of the urllib library in Python, used to open a particular URL.

The urlopen is a method of the urllib library in Python, used to open a particular URL. As a result, a file-like object is returned that contains information about the URL - headers, response data and other details about the requested URL resource.

369 questions
1
vote
2 answers

Get urllib.error.HTTPError: HTTP Error 423: Locked from api.ipgeolocation.io in Flask app

I'm creating a Flask app, in this part in my routes.py I want to get visitors' country and city from their IP with api.ipgeolocation.io, but get error urllib.error.HTTPError: HTTP Error 423: Locked import json from urllib.request import urlopen from…
1
vote
1 answer

HTML junk returned when JSON is expected

The following code used to work but not anymore and I'm seeing junk HTML with success code of 200 returned. response = urlopen('https://www.tipranks.com/api/stocks/stockAnalysisOverview/?tickers='+symbol) data = json.load(response) If you open the…
user1144251
  • 327
  • 1
  • 3
  • 12
1
vote
1 answer

Getting "RemoteDisconnected" Error using urlopen

So i want to simply just read the Html of a website using from urllib.request import urlopen url = 'https://dictionary.cambridge.org/dictionary/english/water' page = urlopen(url) for some websites it woks but for some like in the above code i get…
mike
  • 45
  • 5
1
vote
1 answer

Is there a way to prevent the "bad connection" or "no network" error inside python?

I use urlopen command from urllib.request package and it works properly. But because it is inside an infinite loop I want to consider the possible "No network" Conditions. I do not want my code to break down because of this error. I tried the…
Soheil yns
  • 15
  • 5
1
vote
1 answer

IBM API Connect Gateway script is not being executed

I have conifgured my API DESIGN to hit a local python application http://127.0.0.1:9999/get_batch_filters even with the assemble window being blank this works fine. I have noticed that the gateway scripts are not being executed, also there are no…
Aqua 4
  • 771
  • 2
  • 9
  • 26
1
vote
2 answers

Python BeautifulSoup doesn't scrape any information and produces no errros or warnings

I am trying to scrape some information from a website using BeautifulSoup and I am having huge trouble with it. I have been searching and trying to figure this out for hours now and I cannot figure it out. I am trying to scrape the title of the…
541daw35d
  • 141
  • 2
  • 12
1
vote
1 answer

Changing Permissions on Python Modules so I Don't Need to "sudo" My Python Script Calls

Is there a way to reconfigure all my Python3 modules from which I call certain utilities (i.e., urlopen) so that I no longer need to preface my Python3 script calls with "sudo", without having to rebuild my Ubuntu VM? Example, with my script code as…
John B.
  • 11
  • 3
1
vote
1 answer

How can I read the contents of an URL with Transcrypt? Where is urlopen() located?

In Transcrypt I try to read JSON data from a URL, so I try: import urllib.request data = urllib.request.urlopen(data_url) But I get the error "Import error, can't find [...] urllib.request". So urllib.request doesn't seem to be support;…
halloleo
  • 9,216
  • 13
  • 64
  • 122
1
vote
1 answer

Why is urlopen not working for certain websites?

I am very new to python and I am trying to webscrape some basic data from a client's website. I have tried this exact same method with other websites and received the expected results. This is what I have so far: from urllib.request import…
bknoll16
  • 25
  • 5
1
vote
5 answers

Extract text from a file object using .read()

I'm trying to read the source of a website with this code: import urllib2 z=urllib2.urlopen('http://skreemr.com/results.jsp?q=said+the+whale&search=SkreemR+Search') z.read() print z txt = open('music.txt','w') txt.write(str(z)) txt.close() for i in…
P'sao
  • 2,946
  • 11
  • 39
  • 48
1
vote
1 answer

ValueError: No tables found matching pattern '.+' while using pd.read_html()

I am using the following code to scrape data from 'Worldometers' web site. The code was working fine until yesterday. But today it is giving Value error. I want to continue using urllib Request and urlopen functions. Appreciate any inputs on what…
Srinivas
  • 568
  • 1
  • 4
  • 21
1
vote
1 answer

Timeout value in Python 3 urlopen?

I am have a small crawler and I am extracting a web-page content of a simple page. def url2dict(url): ''' DOCSTRING: converts two-column data into a dictionary with first column as a key. INPUT: URL address as a string OUTPUT:…
Matthew
  • 67
  • 2
  • 11
1
vote
4 answers

How to identify and follow a link, then print data from a new webpage with BeautifulSoup

I am trying to (1) grab a title from a webpage, (2) print the title, (3) follow a link to the next page, (4) grab the title from the next page, and (5) print the title from the next page. Steps (1) and (4) are the same function and steps (2) and…
BSH180_44
  • 35
  • 1
  • 7
1
vote
1 answer

Webscrape ISBN info from brazilian website

I'm trying to get some tags with beautiful soup, to generate a bibtex entry with this data. The ISBN brazilian site, when access from browser, shows the informations about that ISBN. But when i tried to use urlopen and requests, it gives me a…
Jean Pimenta
  • 135
  • 8
1
vote
2 answers

Scraping only select fields from a JSON file

I'm trying to produce only the following JSON data fields, but for some reason it writes the entire page to the .html file? What am I doing wrong? It should only produce the boxes referenced e.g. title, audiosource url, medium sized image, etc? r …
leopheard
  • 101
  • 7