diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2019-05-11 21:38:22 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2019-05-11 21:38:22 +0530 |
commit | 6cbd67bb7232e2ed499a1b94b51d255cbaea0183 (patch) | |
tree | 12dc138f9a9cc7607e146138a08db778dcc1e98c /function-specific-programs | |
parent | 395ea589cc10973ceae07768e7c6484534d17c8d (diff) |
Initial Commit
Diffstat (limited to 'function-specific-programs')
-rw-r--r-- | function-specific-programs/.DS_Store | bin | 0 -> 6148 bytes | |||
-rw-r--r-- | function-specific-programs/1.json | 1 | ||||
-rw-r--r-- | function-specific-programs/__pycache__/tweepy.cpython-37.pyc | bin | 0 -> 1450 bytes | |||
-rw-r--r-- | function-specific-programs/drunk.py | 25 | ||||
-rw-r--r-- | function-specific-programs/ear.py | 117 | ||||
-rw-r--r-- | function-specific-programs/speedlimit.py | 35 | ||||
-rw-r--r-- | function-specific-programs/tweet.py | 43 | ||||
-rw-r--r-- | function-specific-programs/zomato-api.txt | 1 | ||||
-rw-r--r-- | function-specific-programs/zomato.py | 41 |
9 files changed, 263 insertions, 0 deletions
diff --git a/function-specific-programs/.DS_Store b/function-specific-programs/.DS_Store Binary files differnew file mode 100644 index 0000000..d994af4 --- /dev/null +++ b/function-specific-programs/.DS_Store diff --git a/function-specific-programs/1.json b/function-specific-programs/1.json new file mode 100644 index 0000000..1fb2d07 --- /dev/null +++ b/function-specific-programs/1.json @@ -0,0 +1 @@ +{"location":{"entity_type":"subzone","entity_id":33,"title":"JNU","latitude":"28.5486520000","longitude":"77.1722450000","city_id":1,"city_name":"Delhi NCR","country_id":1,"country_name":"India"},"popularity":{"popularity":"4.18","nightlife_index":"3.60","nearby_res":["775","810","18650205","301130","18587192","7352","18337900","304675","18588949"],"top_cuisines":["North Indian","Chinese","Fast Food","Mughlai","Bakery"],"popularity_res":"100","nightlife_res":"10","subzone":"JNU","subzone_id":33,"city":"Delhi NCR"},"link":"https:\/\/www.zomato.com\/ncr\/jnu-delhi-restaurants","nearby_restaurants":[{"restaurant":{"R":{"res_id":775},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"775","name":"Slice of Italy","url":"https:\/\/www.zomato.com\/ncr\/slice-of-italy-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"E-249, Rama Market, Nelson Mandela Marg, Vasant Vihar, New Delhi","locality":"Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5584263898","longitude":"77.1704645455","zipcode":"0","country_id":1,"locality_verbose":"Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Bakery, Italian, Pizza, Sandwich, Salad, American","average_cost_for_two":700,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/773_CHAIN_ac8945db9f2fb7f3a9a2d8d4c54acdf2.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"3.9","rating_text":"Good","rating_color":"9ACD32","votes":"1025"},"photos_url":"https:\/\/www.zomato.com\/ncr\/slice-of-italy-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/slice-of-italy-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/773_CHAIN_ac8945db9f2fb7f3a9a2d8d4c54acdf2.jpg","has_online_delivery":1,"is_delivering_now":1,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/775","order_url":"https:\/\/www.zomato.com\/ncr\/slice-of-italy-vasant-vihar-new-delhi\/order?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","order_deeplink":"","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/slice-of-italy-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":810},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"810","name":"Guruprasad Udupi","url":"https:\/\/www.zomato.com\/ncr\/guruprasad-udupi-munirka-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"DDA Shopping Complex, Phase 2, Munirka, New Delhi","locality":"Munirka","city":"New Delhi","city_id":1,"latitude":"28.5551104578","longitude":"77.1758470684","zipcode":"0","country_id":1,"locality_verbose":"Munirka, New Delhi"},"switch_to_order_menu":0,"cuisines":"South Indian, North Indian, Chinese","average_cost_for_two":600,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/pictures\/chains\/0\/810\/0ea53a4f73a36005a8a772dd0c332827.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"4.0","rating_text":"Very Good","rating_color":"5BA829","votes":"692"},"photos_url":"https:\/\/www.zomato.com\/ncr\/guruprasad-udupi-munirka-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/guruprasad-udupi-munirka-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/pictures\/chains\/0\/810\/0ea53a4f73a36005a8a772dd0c332827.jpg","has_online_delivery":0,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/810","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/guruprasad-udupi-munirka-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":18650205},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"18650205","name":"Roomali Garh","url":"https:\/\/www.zomato.com\/roomali-garh-1?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"Vasant Vihar, New Delhi","locality":"Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5587520876","longitude":"77.1707290784","zipcode":"","country_id":1,"locality_verbose":"Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"North Indian, Mughlai, Rajasthani, Biryani, Indian, Kebab, Desserts","average_cost_for_two":800,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/pictures\/0\/18571190\/4c90d626769e40f5033dcca8561e1eab.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"4.3","rating_text":"Very Good","rating_color":"5BA829","votes":"656"},"photos_url":"https:\/\/www.zomato.com\/roomali-garh-1\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/roomali-garh-1\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"http:\/\/b.zmtcdn.com\/data\/pictures\/0\/18571190\/4c90d626769e40f5033dcca8561e1eab.jpg","has_online_delivery":1,"is_delivering_now":1,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/18650205","order_url":"https:\/\/www.zomato.com\/roomali-garh-1\/order?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","order_deeplink":"","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/roomali-garh-1\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":301130},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"301130","name":"Secular House Canteen","url":"https:\/\/www.zomato.com\/ncr\/mezbaan-restaurant-jnu-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"9\/1, Secular House, Opposite JNU East Gate, JNU, New Delhi","locality":"JNU","city":"New Delhi","city_id":1,"latitude":"28.5445668081","longitude":"77.1783495694","zipcode":"","country_id":1,"locality_verbose":"JNU, New Delhi"},"switch_to_order_menu":0,"cuisines":"North Indian, Mughlai, Chinese","average_cost_for_two":650,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/pictures\/9\/5879\/f7bd9c868414352b6acb75899ef2a8df.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"3.9","rating_text":"Good","rating_color":"9ACD32","votes":"613"},"photos_url":"https:\/\/www.zomato.com\/ncr\/mezbaan-restaurant-jnu-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/mezbaan-restaurant-jnu-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/pictures\/9\/5879\/f7bd9c868414352b6acb75899ef2a8df.jpg?output-format=webp","has_online_delivery":1,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/301130","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/mezbaan-restaurant-jnu-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":18587192},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"18587192","name":"Enoki","url":"https:\/\/www.zomato.com\/ncr\/enoki-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"Vasant Vihar, New Delhi","locality":"Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5579484426","longitude":"77.1714794263","zipcode":"","country_id":1,"locality_verbose":"Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Asian, Japanese, Thai, Sushi, Pok\u00e9, Chinese, Pan Asian, Oriental","average_cost_for_two":1000,"price_range":3,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"","user_rating":{"aggregate_rating":"4.5","rating_text":"Excellent","rating_color":"3F7E00","votes":"486"},"photos_url":"https:\/\/www.zomato.com\/ncr\/enoki-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/enoki-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"","has_online_delivery":1,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/18587192","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/enoki-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":7352},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"7352","name":"Domino's Pizza","url":"https:\/\/www.zomato.com\/ncr\/dominos-pizza-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"6, Basant Lok Market, Priya Cinema Complex, Vasant Vihar, New Delhi","locality":"Basant Lok Market, Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5577564386","longitude":"77.1645056829","zipcode":"0","country_id":1,"locality_verbose":"Basant Lok Market, Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Pizza, Fast Food","average_cost_for_two":600,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/143_CHAIN_b9076b3fb4092225bc1e60ceb20c51ab.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"3.9","rating_text":"Good","rating_color":"9ACD32","votes":"598"},"photos_url":"https:\/\/www.zomato.com\/ncr\/dominos-pizza-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/dominos-pizza-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/143_CHAIN_b9076b3fb4092225bc1e60ceb20c51ab.jpg?output-format=webp","has_online_delivery":0,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/7352","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/dominos-pizza-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":18337900},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"18337900","name":"Leo's","url":"https:\/\/www.zomato.com\/ncr\/leos-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"28, Basant Lok Market, Vasant Vihar, New Delhi","locality":"Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5586225153","longitude":"77.1638187021","zipcode":"110030","country_id":1,"locality_verbose":"Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Cafe, Pizza, Italian","average_cost_for_two":1200,"price_range":3,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/18337900_RESTAURANT_b1b2e42123cb0cb48067da4f08434e52.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"4.2","rating_text":"Very Good","rating_color":"5BA829","votes":"436"},"photos_url":"https:\/\/www.zomato.com\/ncr\/leos-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/leos-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/res_imagery\/18337900_RESTAURANT_b1b2e42123cb0cb48067da4f08434e52.jpg","has_online_delivery":0,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/18337900","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/leos-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":304675},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"304675","name":"Yo! China","url":"https:\/\/www.zomato.com\/ncr\/yo-china-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"46, 1st Floor, Priya Cinema Complex, Basant Lok Market, Vasant Vihar, New Delhi","locality":"Basant Lok Market, Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5573965773","longitude":"77.1636349708","zipcode":"","country_id":1,"locality_verbose":"Basant Lok Market, Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Thai, Asian, Chinese, Beverages, Seafood, Momos","average_cost_for_two":1150,"price_range":3,"currency":"Rs.","offers":[],"zomato_events":[{"event":{"event_id":194525,"friendly_start_date":"01 December","friendly_end_date":"31 December","friendly_timing_str":"Saturday, 1st December - Monday, 31st December","start_date":"2018-12-01","end_date":"2018-12-31","end_time":"23:00:00","start_time":"11:00:00","is_active":1,"date_added":"2018-02-15 07:41:53","photos":[],"restaurants":[],"is_valid":1,"share_url":"http:\/\/www.zoma.to\/r\/0","show_share_url":0,"title":"BIRTHDAY PARTY KITTY PARTY","description":"Celebrate Memorable Birthday and Kitty parties with us @ 299 onwards with unlimited appetisers, rice\/noodle, main course, soft drinks, icecream and free decoration, games, prizes etc. Call us at 011 26151919\/1929","display_time":"11:00 am - 11:00 pm","display_date":"01 December - 31 December","is_end_time_set":1,"disclaimer":"Restaurants are solely responsible for the service; availability and quality of the events including all or any cancellations\/ modifications\/ complaints.","event_category":1,"event_category_name":"","book_link":"","types":[],"share_data":{"should_show":0}}}],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/reviews_photos\/06b\/8d69c91c75e296a1d66986a20f30306b_1462782211.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"3.7","rating_text":"Good","rating_color":"9ACD32","votes":"531"},"photos_url":"https:\/\/www.zomato.com\/ncr\/yo-china-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/yo-china-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/reviews_photos\/06b\/8d69c91c75e296a1d66986a20f30306b_1462782211.jpg","medio_provider":1,"has_online_delivery":1,"is_delivering_now":0,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/304675","is_table_reservation_supported":1,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/yo-china-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}},{"restaurant":{"R":{"res_id":18588949},"apikey":"a530c1424d9abe5442fa22f77ce03d25","id":"18588949","name":"Gabbars","url":"https:\/\/www.zomato.com\/ncr\/gabbars-vasant-vihar-new-delhi?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","location":{"address":"Shop No.15, DDA Shopping Centre, Munirka Vihar, Vasant Vihar, New Delhi","locality":"Vasant Vihar","city":"New Delhi","city_id":1,"latitude":"28.5543398000","longitude":"77.1668179000","zipcode":"110068","country_id":1,"locality_verbose":"Vasant Vihar, New Delhi"},"switch_to_order_menu":0,"cuisines":"Mughlai, North Indian","average_cost_for_two":700,"price_range":2,"currency":"Rs.","offers":[],"opentable_support":0,"is_zomato_book_res":0,"mezzo_provider":"OTHER","is_book_form_web_view":0,"book_form_web_view_url":"","book_again_url":"","thumb":"https:\/\/b.zmtcdn.com\/data\/pictures\/chains\/9\/18588949\/e349fb34fa2010d93000df99d823f3a7.jpg?fit=around%7C200%3A200&crop=200%3A200%3B%2A%2C%2A","user_rating":{"aggregate_rating":"4.5","rating_text":"Excellent","rating_color":"3F7E00","votes":"368"},"photos_url":"https:\/\/www.zomato.com\/ncr\/gabbars-vasant-vihar-new-delhi\/photos?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1#tabtop","menu_url":"https:\/\/www.zomato.com\/ncr\/gabbars-vasant-vihar-new-delhi\/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop","featured_image":"https:\/\/b.zmtcdn.com\/data\/pictures\/chains\/9\/18588949\/e349fb34fa2010d93000df99d823f3a7.jpg","has_online_delivery":1,"is_delivering_now":1,"include_bogo_offers":true,"deeplink":"zomato:\/\/restaurant\/18588949","order_url":"https:\/\/www.zomato.com\/ncr\/gabbars-vasant-vihar-new-delhi\/order?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1","order_deeplink":"","is_table_reservation_supported":0,"has_table_booking":0,"events_url":"https:\/\/www.zomato.com\/ncr\/gabbars-vasant-vihar-new-delhi\/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1"}}]}
\ No newline at end of file diff --git a/function-specific-programs/__pycache__/tweepy.cpython-37.pyc b/function-specific-programs/__pycache__/tweepy.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..a8b2550 --- /dev/null +++ b/function-specific-programs/__pycache__/tweepy.cpython-37.pyc diff --git a/function-specific-programs/drunk.py b/function-specific-programs/drunk.py new file mode 100644 index 0000000..7e4d94d --- /dev/null +++ b/function-specific-programs/drunk.py @@ -0,0 +1,25 @@ +from uber_rides.session import Session +from uber_rides.client import UberRidesClient + + +session = Session(server_token=<TOKEN>) +client = UberRidesClient(session) + + +print("Your Location Appears to be around places which sells \n alcohol, please taka the breathalyser test ") + +bac = 0.02 + +if(bac >= 0.08): + print("Please Do Not Drive!\n") + print("I can call a cab if you want\n") + print("Say No, to disagree, else I'll book the cab") + input = yes + if(input==no): + print("You are not fit to drive") + print("Text message to emergency contact sent") + break + print("Your cab has been booked, thank you for not driving") + break +print("have a safe journey!") + diff --git a/function-specific-programs/ear.py b/function-specific-programs/ear.py new file mode 100644 index 0000000..a40e065 --- /dev/null +++ b/function-specific-programs/ear.py @@ -0,0 +1,117 @@ +# Using Eye aspect ratio +from scipy.spatial import distance as dist +from imutils.video import VideoStream +from imutils import face_utils +from threading import Thread +import numpy as np +import playsound +import argparse +import imutils +import time +import dlib +import cv2 + +def sound_alarm(): + print('You Sleep You Lose') + +def eye_aspect_ratio(eye): + # Computes the euclidean distances between the two sets of eyes + A = dist.euclidean(eye[1], eye[5]) + B = dist.euclidean(eye[2], eye[4]) + + # compute the euclidean distance between the horizontal + # eye landmark (x, y)-coordinates + C = dist.euclidean(eye[0], eye[3]) + + # compute the eye aspect ratio + ear = (A + B) / (2.0 * C) + # return the eye aspect ratio + return ear + +shape_predictor = "../files/shape_predictor_68_face_landmarks.dat" + + +EYE_AR_THRESH = 0.2 # If the EAR goes < this for 48 frames, it is counted as drowsiness +EYE_AR_CONSEC_FRAMES = 48 + +COUNTER = 0 +ALERT = False + +# initialize dlib's face detector (HOG-based) and then create +# the facial landmark predictor +print("Initialising Facial Landmark Predictor...") +detector = dlib.get_frontal_face_detector() +predictor = dlib.shape_predictor(shape_predictor) + +(lStart, lEnd) = face_utils.FACIAL_LANDMARKS_IDXS["left_eye"] +(rStart, rEnd) = face_utils.FACIAL_LANDMARKS_IDXS["right_eye"] + +print("Starting Video Stream...") +vs = VideoStream(src=0).start() +time.sleep(1.0) + +while True: + frame = vs.read() + frame = imutils.resize(frame, width=450) + gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + + rects = detector(gray, 0) + for rect in rects: + shape = predictor(gray, rect) + shape = face_utils.shape_to_np(shape) + + # extract the left and right eye coordinates, then use the + # coordinates to compute the eye aspect ratio for both eyes + leftEye = shape[lStart:lEnd] + rightEye = shape[rStart:rEnd] + leftEAR = eye_aspect_ratio(leftEye) + rightEAR = eye_aspect_ratio(rightEye) + + # average the eye aspect ratio together for both eyes + ear = (leftEAR + rightEAR) / 2.0 + # compute the convex hull for the left and right eye, then + # visualize each of the eyes + leftEyeHull = cv2.convexHull(leftEye) + rightEyeHull = cv2.convexHull(rightEye) + cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 0), 1) + cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 0), 1) + # check to see if the eye aspect ratio is below the blink + # threshold, and if so, increment the blink frame counter + if ear < EYE_AR_THRESH: + COUNTER += 1 + + # if the eyes were closed for a sufficient number of + # then sound the alarm + if COUNTER >= EYE_AR_CONSEC_FRAMES: + # if the alarm is not on, turn it on + if not ALARM_ON: + ALARM_ON = True + + # draw an alarm on the frame + cv2.putText(frame, "Sleepiness Detected!", (10, 30), + cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) + print("Sleepiness Detected!") + print("\a");print("\a");print("\a");print("\a");print("\a") + print("\a");print("\a");print("\a");print("\a");print("\a") + print("\a");print("\a");print("\a");print("\a");print("\a") + + + + else: + COUNTER = 0 + ALARM_ON = False + + cv2.putText(frame, "Ratio: {:.2f}".format(ear), (300, 30), + cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) + + # show the frame + cv2.imshow("Frame", frame) + key = cv2.waitKey(1) & 0xFF + + # if the `q` key was pressed, break from the loop + if key == ord("q"): + break + +# do a bit of cleanup +cv2.destroyAllWindows() +vs.stop()
\ No newline at end of file diff --git a/function-specific-programs/speedlimit.py b/function-specific-programs/speedlimit.py new file mode 100644 index 0000000..7a21595 --- /dev/null +++ b/function-specific-programs/speedlimit.py @@ -0,0 +1,35 @@ +import overpy +import sys +import simplejson as sjson +import json +import geocoder + +g = geocoder.ip('me') + +def maxspeed(coordinates, radius): + lat, lon = coordinates + api = overpy.Overpass() + + result = api.query(""" + way(around:""" + radius + """,""" + lat + """,""" + lon + """) ["maxspeed"]; + (._;>;); + out body; + """) + results_list = [] + for way in result.ways: + road = {} + road["name"] = way.tags.get("name", "n/a") + road["speed_limit"] = way.tags.get("maxspeed", "n/a") + nodes = [] + for node in way.nodes: + nodes.append((node.lat, node.lon)) + road["nodes"] = nodes + results_list.append(road) + return results_list + + +results = maxspeed((sys.argv[1], sys.argv[2]), sys.argv[3]) +# Alternative +# results = maxspeed((lat, long, radius)) +speedlimit = sjson.dumps(results[0]['speed_limit']).strip('\"') +print(speedlimit)
\ No newline at end of file diff --git a/function-specific-programs/tweet.py b/function-specific-programs/tweet.py new file mode 100644 index 0000000..e9bfdfb --- /dev/null +++ b/function-specific-programs/tweet.py @@ -0,0 +1,43 @@ +""" +import tweepy + +#twitter application credentials +consumer_key="knQFpTnjuSvr6OxYwebt3wyrd" +consumer_secret="Mhex3oRkmaF7lD3hoMvHpAD6ctW0ugKYCopTlhc0JzOLOMIZ0w" + +#twitter user credentials +access_token="2846631344-wEozinvHfEIFxFVy51I6te8SrN5OTFtU00wxsiz" +access_token_secret="Nfx1U8a2TjAQXFLBrJIyy2p36sjBGAWFIthLc1cIoI56U" + +auth = tweepy.OAuthHandler(consumer_key, consumer_secret) +auth.set_access_token(access_token, access_token_secret) + +tweepyapi = tweepy.API(auth) + +tweepyapi.update_status('Hello World!') +print("Hello " + tweepyapi.me().name) +""" + +import tweepy + +def get_api(cfg): + auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret']) + auth.set_access_token(cfg['access_token'], cfg['access_token_secret']) + return tweepy.API(auth) + +def main(): + # Fill in the values noted in previous step here + cfg = { + "consumer_key" : "knQFpTnjuSvr6OxYwebt3wyrd", + "consumer_secret" : "Mhex3oRkmaF7lD3hoMvHpAD6ctW0ugKYCopTlhc0JzOLOMIZ0w", + "access_token" : "2846631344-wEozinvHfEIFxFVy51I6te8SrN5OTFtU00wxsiz", + "access_token_secret" : "Nfx1U8a2TjAQXFLBrJIyy2p36sjBGAWFIthLc1cIoI56U" + } + + api = get_api(cfg) + tweet = "Hello, world!" + status = api.update_status(status=tweet) + # Yes, tweet is called 'status' rather confusing + +if __name__ == "__main__": + main()
\ No newline at end of file diff --git a/function-specific-programs/zomato-api.txt b/function-specific-programs/zomato-api.txt new file mode 100644 index 0000000..802c636 --- /dev/null +++ b/function-specific-programs/zomato-api.txt @@ -0,0 +1 @@ +a530c1424d9abe5442fa22f77ce03d25 diff --git a/function-specific-programs/zomato.py b/function-specific-programs/zomato.py new file mode 100644 index 0000000..26b4c43 --- /dev/null +++ b/function-specific-programs/zomato.py @@ -0,0 +1,41 @@ +import requests +import simplejson as sjson +import json + +res = [] + +def getRes(): + headers = { + 'Accept': 'application/json', + 'user-key': 'a530c1424d9abe5442fa22f77ce03d25', + } + + params = ( + ('lat', '28.546519'), + ('lon', '77.179248'), + ) + + response = requests.get('https://developers.zomato.com/api/v2.1/geocode', headers=headers, params=params) + res = response.json()['popularity']['nearby_res'] + return res + +def getDetails(res): + headers = { + 'Accept': 'application/json', + 'user-key': 'a530c1424d9abe5442fa22f77ce03d25', + } + url = "https://developers.zomato.com/api/v2.1/restaurant?res_id=" + str(res[0]) + newResponse = requests.get(url, headers=headers) + newRes = [] + resName = newResponse.json()['name'] + resAddress = newResponse.json()['location']['address'] + print("You are feeling sleepy, why don't you take a break?\n") + print("Your nearest eatery is " + resName,"\n") + print(resName + " is at " + resAddress,"\n") +def zomato(): + + res = getRes() + getDetails(res) +zomato() + + |