9

Check for failure metals = requests.get('https://www.lme.com/').text should be response = requests.get('https://www.lme.com/') response.raise_for_status() metals = response.text String literals don't need parens date = datetime.datetime.now() time = (f'{date.day}/{date.month}/{date.year} | {date.hour}:{date.minute}') would only need parens if it spans ...


3

I think it would be better to handle the API stuff to convert prices using a Python package like CurrencyConverter. The site that you are using currently might be down some day or may blacklist your IP because of the many requests that your code is making to convert the prices. Also, your code seems to be better converted to a Scrapy project if you are ...


2

You can tidy up the code a bit by directly returning results from functions and not using temporary variables you use only once. I would also do the conversion to floats directly in the functions. BeautifulSoup can directly work on the binary response.content, no need to decode it into a string yourself by using response.text. def get_metal_values(): ...


Only top voted, non community-wiki answers of a minimum length are eligible