I want to download a list of URLs and download them. It doesn't work too well. It throws out an error like so:
"TypeError: an integer is required(got type str)"
import os
loc = requests.get("https://theipaarchive.tk/listofipa.txt")
listofipa = os.open(loc.content, "rt")
for line in listofipa:
r = requests.get(line)
It occurs on line 4. hmm
CodePudding user response:
This should be enough:
import requests
loc = requests.get("https://theipaarchive.tk/listofipa.txt")
for line in loc.iter_lines():
file = requests.get(line)
...
CodePudding user response:
Given the way your file is written, you should just write :
import os
loc = requests.get("https://theipaarchive.tk/listofipa.txt")
listofipa = os.open(loc.text, "rt")
for line in listofipa:
r = requests.get(line)