Feb-21-2018, 04:36 PM
I'm very new to Python. I've studied a lot of books but putting all of it into practice is taxing to me. Any help you can provide is much appreciated!
When I run this...
When I run this...
from bs4 import BeautifulSoup import requests import re import urllib import zipfile import os apis = ["49025219260000", "49025059260000", "49025206640000", "49025203350000", "49025213300000", "49025061090000", "49025062840000", ] def wogcc_completions_scraper(): x = 0 while x < len(apis): wogcc_url = """http://wogcc.state.wy.us/wyocompletions.cfm?nApino=""" + str(apis[x][3:10]) print (apis[x]) print str(apis[x][3:10]) las_only = [] wogcc_request = requests.get(wogcc_url) soup = BeautifulSoup(wogcc_request.content, "html.parser") href_tags = soup.find_all('a') ### This section of code will data scrape the WOGCC for the completion reports completion_regex = """<td align="left" bgcolor="white" nowrap="" valign="Middle" width="450"><strong><font size="1">(.+?)</font></strong></td>""" completion_pattern = re.compile(completion_name_regex) completion_file = re.findall(completion_name_pattern, str(soup)) CNF = completion_name_fileI get this...
Traceback (most recent call last): File "C:\WOGCC Well Completions Scraper Lil Scraper 1.2b.py", line 85, in <module> wogcc_completions_scraper() File "C:\WOGCC Well Completions Scraper Lil Scraper 1.2b.py", line 42, in wogcc_completions_scraper completion_pattern = re.compile(completion_name_regex) NameError: global name 'completion_name_regex' is not defined