Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Commit #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
22 changes: 3 additions & 19 deletions Week-1/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# Problem 1 - Ankit's Phone

Ankit recently came 1st at a hackathon and now he wants to buy a new phone with the prize money he received. He is confused between iPhone 11 and OnePlus 7T Pro. Since he is very busy preparing for his exams, he needs your help. Give him a list of features comparing the 2 phones.

## Basic Requirements

**Output** : A file containing [JSON](https://www.copterlabs.com/json-what-it-is-how-it-works-how-to-use-it/) of the features of the 2 phones. (We'll leave the JSON format details up to you, but they should at least contain the Price, Operating System, Internal Storage, Camera features, Connectivity features and any other features that you would want to include).

## Next Steps

Once you are done with the basic requirements, get creative! Try to scrape the price of each of the phones at regular intervals and inform the user if there is a price drop via email/sms.

## Resources

You can use any language you prefer, but we'd recommend python ( Please don't use [python 2](https://wiki.python.org/moin/Python2orPython3)! ) Make sure you read and follow the [coding instructions](../CODING_INSTRUCTIONS.md). Here are some resources to get you started:

- IET Explains: [Web Scraping w Python | Beautiful Soup](https://www.youtube.com/watch?v=oLbjA8mBK2Q&feature=youtu.be)
- [freeCodeCamp's post on scraping](https://medium.freecodecamp.org/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe)
- Python guides for [command line args](https://pymotw.com/3/argparse/index.html#module-argparse), [json](https://pymotw.com/3/json/index.html) & [file io](https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files)
I used Beautiful Soup For web scraping the features of the phones. I used GadgetsNow website for scraping as this enabled me to scrap the features of both the phones using a single webpage.
I created a dataframe and then created a json file. Then I am running while loop infinitely, and in every loop I am checking the prices of the phones using Flipkart(For dynamic pricing),
and if there is price difference, sendMail function sends a mail to the user, and also json file is updated. After every iteration there is a sleep time of 20s.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Week-1/Sanskar31/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Week-1/Sanskar31/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Week-1/Sanskar31/.idea/web_scrap.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

168 changes: 168 additions & 0 deletions Week-1/Sanskar31/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Week-1/Sanskar31/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0":{"0":"Feature","1":"Price","2":"Storage","3":"Operating System","4":"Front Camera","5":"Rear Camera","6":"Network Support","7":"Wifi"},"1":{"0":"Iphone 11","1":"\u20b964,900","2":"64 GB","3":"iOS v13.0","4":"12 MP Front Camera","5":"12 MP + 12 MP","6":"4G (supports Indian bands), 3G, 2G","7":" Wi-Fi 802.11, a\/ac\/ax\/b\/g\/n\/n 5GHz, MIMO"},"2":{"0":"OnePlus 7t Pro","1":"\u20b953,589","2":"256 GB","3":"Android v10 (Q)","4":"16 MP Front Camera","5":"48 MP + 16 MP + 8 MP","6":"4G (supports Indian bands), 3G, 2G","7":" Wi-Fi 802.11, a\/ac\/b\/g\/n\/n 5GHz, MIMO"}}
Loading