Skip to content

Instantly share code, notes, and snippets.

View harsh546's full-sized avatar

Harsh harsh546

View GitHub Profile
@harsh546
harsh546 / web_scrap.py
Last active February 24, 2024 10:45
Web Scrapring Price Comparison
# Code by Harsh
# Python program that compares the price of a product on Amazon and Flipkart using web scraping.
"""
First, you need to install the requests and beautifulsoup4 libraries.
You can do this by running the following command in your terminal or command prompt:
pip install requests beautifulsoup4
"""
import requests
from bs4 import BeautifulSoup
@harsh546
harsh546 / using_api_with_python.py
Last active March 26, 2023 00:07
Example Using API with Python
import requests
def convert_usd_to_inr(amount):
from_currency = 'usd'
to_currency = 'inr'
url = "https://api.apilayer.com/exchangerates_data/convert?to={0}&from={1}&amount={2}".format(to_currency,from_currency,amount)
payload = {}
headers= {
"apikey": "<Your API Key>" #Visit "https://apilayer.com/" and create your own api key
}