Created
September 24, 2019 14:07
-
-
Save chapagainmanoj/64076efc98e265088c8a491ca19fc283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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