Skip to content

Instantly share code, notes, and snippets.

@chapagainmanoj
Created September 24, 2019 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapagainmanoj/64076efc98e265088c8a491ca19fc283 to your computer and use it in GitHub Desktop.
Save chapagainmanoj/64076efc98e265088c8a491ca19fc283 to your computer and use it in GitHub Desktop.
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
headers = {'User-Agent': user_agent}
url = 'https://www.investing.com/currencies/eur-usd'
response = requests.get(url, headers = headers)
soup = BeautifulSoup(response.text, 'html.parser')
rate = soup.find('span', {"id": "last_last"})
print(rate.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment