Beginner Question for Web Scraping in Python

Hello, I have this line of code where I can pull something specific from a url within the code. But, I want to be able to have the user enter the latitude and longitude of a
weather station and for it to obtain and display:

  • Station Name
  • Current Conditions eg. Sunny, Partly Cloudy etc.
  • Temperature in Fahrenheit
  • Elevation

So I tried to alter it with a couple of things such as latlong’s () coordinates. I’m not where to go from here to get specific results based on what the user inputs, and not specific info
that’s pulled from coordinates in the url that I provide myself in the code:

import bs4, requests

print('Enter the location: ')
lat = input()

url = ‘’
latlong = ‘lat={}&lon=-{}’.format(lat, lon)
res = requests.get(url + latlong)
soup = bs4.BeautifulSoup(res.text, ‘html.parser’)
elems =’#current-conditions > div.panel-heading > div > h2’)
stationName = elems[0].text
except Exception as ex:
print(‘There was a problem retrieving the information’)

I don’t know why scraping is giving me so much trouble. Any know a good way this can be done?

This is probably what you want instead:

That should give you access to all of the NOAA weather stations and you don’t need to use scrapy.