Apr-09-2018, 09:49 PM
from bs4 import BeautifulSoup import re import urlib3 "Define the name of my web scraper. We want the scraper to continue to look for completions until it reaches a zero value." apis = ["49009229900000”,“49009226390000”,“49009278600000”,“49009226340000”,“49009200210000”,“49009065760000”,“49009201380000”,“49009230130000”,“49009278800000”,“49009222250000”,“49009225900000”,“49009219970000”,“49009225890000”,“49009225140000”,“49009225760000”,“49009212630000”,“49009205440000”,“49009211590000”,“49009203660000”,“49009203940000”,“49009204340000”,“49009226780000”,“49009220310000”,“49009229730000”,“49009212240000”,“49009214450000”,“49009213790000”,“49009222660000”,“49009227960000”,“49009222100000”,“49009228020000”,“49009228260000”,“49009228290000”,“49009229090000”,“49009228250000”,“49009229340000”,“49009229360000”,“49009227890000”,“49009228010000”,“49009228030000”,“49009228450000”,“49009224160000”,“49009221890000”,“49009222760000”,“49009214980000”,“49009214620000”,“49009213800000”,“49009214380000”,“49009214730000”,“49009228150000”,“49009228190000”,“49009227710000”,“49009215280000”,“49009228940000”,“49009227920000”,“49009227980000”,“49009228170000”,“49009219540000”,“49009227870000”,“49009228370000”,“49009204330000”,“49009205120000”,“49009227860000”,“49009228360000”,“49009228160000”,“49009216100000”,“49009229000000”,“49009229150000”,“49009229490000”,“49009215680000”,“49009229350000”,“49009215210000”,“49009217070000”,“49009216610000”,“49009206800000”,“49009205590000”,“49009206310000”,“49009217960000”,“49009223190000”,“49009210640000”,“49009209260000”,“49009213710000”,“49009212360000”,“49009212740000”,“49009218680000”,“49009210130000”,“49009211420000”,“49009224280000”,“49009213750000”,“49009220880000”,“49009225300000”,“49009218090000”,“49009227720000”,“49009225830000”,“49009223170000”,“49009209370000”,“49009214990000”,“49009207260000”,“49009211540000”,“49009227380000”] def completions_scraper(): x = 0 while x < len(apis): ##When you put your mouse over the completions link the wogcc_url is what you find. The str(api[x][3:10] strips the first 3 digits from the API (UWI) and the last 4 as well.## wogcc_url = "http://wogcc.state.wy.us/wyocompletions.cfm?nApino=" + str(api[x][3:10]) ##We are calling on Beautiful Soup to do its magic.## soup = BeautifulSoup(html_doc, 'html.parser') href_tags = soup.find_all('a') print (apis[x]) print str(apis[x][3:10]) wogcc_request = requests.get(wogcc_url) b = 0 ## This is the counter to keep consistency for our loops.## CNF = completion_name_file completion_name = "" completion_pattern = re.compile(completion_name_1) completion_file = re.findall(completion_name, str(href_tags)) CFEL = completion_file_end_link final_completion_link = [] if final_completion_link == 0: pass else: while b < len(CFEL): ##This will download the reports.## download1 = requests.get(final_raster_link[b]) with open((str(apis[x]) + "_" str(RNF[b].replace("/","")), "IDK" as code: b +=1 x +=1This is what I get...
Error:Syntax Error
EOL While Scanning String Literal
The error seems to happen at the end of my apis.Ideas? Any help / ideas are most appreciated!