Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 685cd0e

Browse files
Merge pull request avinashkranjan#1 from avinashkranjan/master
update
2 parents d7aed7e + cae89d8 commit 685cd0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+35316
-995
lines changed

‎.all-contributorsrc‎

Lines changed: 0 additions & 865 deletions
This file was deleted.

‎Attachment_Downloader/README.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Attachment Downloader
2+
3+
The script downloads gmail atttachment(s) in no time!
4+
5+
6+
# Setup Instructions
7+
8+
The script uses ezgmail module (to know more visit https://pypi.org/project/EZGmail/). To install please type the following command in your bash.
9+
10+
```bash
11+
pip install EZGmail
12+
```
13+
14+
Once the module is installed you will need to download credentials.json file by going to [developers.google.com](https://developers.google.com/gmail/api/quickstart/python) and clicking the Enable the Gmail API button (select "Desktop app" as OAuth Client in second step).
15+
16+
Once you have credentials.json (in root directory of project folder), the first time you run the script it will open up a browser window asking you to log in to your Gmail account and allow "Quickstart" app to access it. A token.json file will be generated (in root directory of project folder) which your script can use to access your account.
17+
18+
# Outputs
19+
20+
## Output 1
21+
22+
![image](https://user-images.githubusercontent.com/75886245/111307477-82e5d100-867f-11eb-8461-58abd04fa56a.png)
23+
24+
## Output 2
25+
26+
![image](https://user-images.githubusercontent.com/75886245/111307625-ba547d80-867f-11eb-8f3b-77ded9e72416.png)
27+
28+
## Output 3
29+
30+
![image](https://user-images.githubusercontent.com/75886245/111307771-e66ffe80-867f-11eb-8bbe-457675fcb963.png)
31+
32+
## Output 4
33+
34+
![image](https://user-images.githubusercontent.com/75886245/111307864-0273a000-8680-11eb-8400-3009dff8d7db.png)
35+
36+
# Author
37+
38+
Contributed by Kirtan Bhatt

‎Attachment_Downloader/attachment.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import ezgmail
2+
3+
def attachmentdownload(resulthreads):
4+
# Two Objects used in code are GmailThread and GmailMessage
5+
# 1. GmailThread - Represents conversation threads
6+
# 2. GmailMessage - Represents individual emails within Threads
7+
countofresults = len(resulthreads)
8+
try:
9+
for i in range(countofresults):
10+
if len(resulthreads[i].messages) > 1: # checks whether the count of messages in threads is greater than 1
11+
for j in range(len(resulthreads[i].messages)):
12+
resulthreads[i].messages[
13+
j].downloadAllAttachments() # downloads attachment(s) for individual messages
14+
else:
15+
resulthreads[i].messages[0].downloadAllAttachments() # downloads attachment(s) for single message
16+
print("Download compelete. Please check your root directory.")
17+
except:
18+
raise Exception("Error occured while downloading attachment(s).")
19+
20+
21+
if __name__ == '__main__':
22+
query = input("Enter search query: ")
23+
newquery = query + " + has:attachment" # appending to make sure the result threads always has an attachment
24+
resulthreads = ezgmail.search(newquery) # search functions accepts all the operators described at https://support.google.com/mail/answer/7190?hl=en
25+
26+
if len(resulthreads) == 0:
27+
print("Result has no attachments:") # Executed if results don't have attachment
28+
else:
29+
print("Result(s) with attachments:")
30+
for threads in resulthreads:
31+
print(f"Email Subject: {threads.messages[0].subject}") # prints the subject line of email thread in results
32+
try:
33+
ask = input(
34+
"Do you want to download attachment(s) in result(s) (Yes/No)? ") # Allows user to decide whether they want to download attachment(s) or not
35+
if ask == "Yes":
36+
attachmentdownload(resulthreads) # calls the function that downloads attachment(s)
37+
else:
38+
print("Program exited")
39+
except:
40+
print("Something went wrong")
41+
42+
43+
44+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import pandas as pd # Pandas library is used for importing and reading the data
2+
import datetime # datetime module is used for fetching the dates
3+
import smtplib # smtp library used for sending mail
4+
import os
5+
6+
current_path = os.getcwd()
7+
print(current_path)
8+
os.chdir(current_path) # Changing the Path of the directory in which you are currently working
9+
10+
GMAIL_ID = input("Enter your email: ") # Give your mail here from which you want to send the wishes
11+
GMAIL_PSWD = input("Enter password for your email mentioned above: ") # Give your mail password
12+
13+
14+
def sendEmail(to, sub, msg):
15+
print(f"Email to {to} sent: \nSubject: {sub} ,\nMessage: {msg}")
16+
s = smtplib.SMTP('smtp.gmail.com', 587) # creating server to send mail
17+
s.starttls() # start a TLS session
18+
s.login(GMAIL_ID, GMAIL_PSWD) # the function will login with your Gmail credentials
19+
s.sendmail(GMAIL_ID, to, f"Subject: {sub} \n\n {msg}") # sending the mail
20+
s.quit()
21+
22+
23+
if __name__ == "__main__":
24+
df = pd.read_excel("data.xlsx") # the datasheet where the data of the friends is stored
25+
today = datetime.datetime.now().strftime("%d-%m")
26+
yearNow = datetime.datetime.now().strftime("%Y")
27+
28+
writeInd = []
29+
for index, item in df.iterrows():
30+
bday = item['Birthday']
31+
bday = datetime.datetime.strptime(bday, "%d-%m-%Y")
32+
bday = bday.strftime("%d-%m")
33+
if(today == bday) and yearNow not in str(item['LastWishedYear']):
34+
sendEmail(item['Email'], "Happy Birthday", item['Dialogue']) # calling the sendmail function
35+
writeInd.append(index)
36+
37+
if writeInd != None:
38+
for i in writeInd:
39+
oldYear = df.loc[i, 'LastWishedYear']
40+
df.loc[i, 'LastWishedYear'] = str(oldYear) + ", " + str(yearNow)
41+
42+
df.to_excel('data.xlsx', index=False)

‎Auto Birthday Wisher/README.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Auto Birthday Wisher
2+
3+
One forgets to send birthday wishes to friends many times. At such times an automatic birthday wisher comes handy. An automatic birthday wisher via email makes one's life easy. It will send the birthday wishes to friends via email automatically via a server and using an excel sheet to store the data of friends and their birthdays along with email id. It'll send the wishes to friends for all the upcoming years untill we stop the server.
4+
5+
## Setup instructions
6+
7+
In order to run this script, You just need the following modules:
8+
9+
- **Pandas** is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool,
10+
built on top of the Python programming language.
11+
```bash
12+
pip install pandas
13+
```
14+
15+
- **Datetime** is a module used for Encapsulation of date/time values.
16+
```bash
17+
pip install DateTime
18+
```
19+
20+
- **smtplib** module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.
21+
22+
## Configuration
23+
1. Assign the Gmail Id of sender to the GMAIL_ID variable in *line 10* of **"Auto B'Day Wisher.py"** file. (e.g. 'xyz@gmail.com')
24+
2. Similar to first step assign the Gmail password of sender to the GMAIL_PSWD variable in *line 11* of **"Auto B'Day Wisher.py"** file. (e.g. '1234')
25+
3. In **"data.xlsx"** file insert the name of the receiver in second column under *Name*. Similarly update the **Birthday** field with the birth date of receiver in the given format*("%dd-%mm-%YYYY")*. Update the **Dailogue** field with a short message you want to send and the **Email** field with the email of the receiver.
26+
4. Make sure to give permission to your google account from which you're sending email to **Allow less secure apps**. Just turn this *"ON"* from [here](https://support.google.com/accounts/answer/6010255?hl=en#zippy=%2Cif-less-secure-app-access-is-off-for-your-account).
27+
5. Run the command
28+
```bash
29+
python "Auto B'Day Wisher.py"
30+
```
31+
32+
## Screenshots
33+
34+
<p align="center">
35+
<img src="https://raw.githubusercontent.com/SpecTEviL/Amazing-Python-Scripts/AutoBDayWisher-GSSoC'21%23623/Auto%20Birthday%20Wisher/emailReceived.jpg" height="700" alt="Email received by friend"/>
36+
<br>
37+
Birthday Wishes received by the Friend via Email
38+
</p>
39+
40+
## Author
41+
42+
[Vishal Patil](https://github.com/SpecTEviL)

‎Auto Birthday Wisher/data.xlsx‎

5.02 KB
Binary file not shown.
131 KB
Loading[フレーム]

‎Blackjack/README.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Blackjack
2+
3+
Blackjack (also known as 21) is a multiplayer card game, with fairly simple rules.
4+
5+
For this script, I am implementing a simplified version where a user can play against the computer who acts as dealer.
6+
7+
Two cards are dealt to each player. The dealer shows one card face up, and the other is face down. The player gets to see both of his or her cards and the total of them is added.
8+
9+
Aces are worth 1 or 11 points, and all other cards are worth their face value. The goal of the game is to get as close to 21 ("blackjack") without going over (called "busting.")
10+
11+
The human player goes first, making his or her decisions based on the single dealer card showing.
12+
13+
</br>
14+
15+
The player has two choices: Hit or Stand.
16+
- Hit means to take another card.
17+
- Stand means that the player wishes no more cards, and ends the turn, allowing for the dealer to play.
18+
19+
The dealer must hit if their card total is less than 17, and must stand if it is 17 or higher.
20+
21+
Whichever player gets closest to 21 without exceeding it, wins.
22+
23+
</br>
24+
25+
## Example Run
26+
27+
![demo](https://user-images.githubusercontent.com/73488906/111056858-9854d280-84a8-11eb-9cbe-c5858764c6bc.png)
28+
![demo](https://user-images.githubusercontent.com/73488906/111056838-50ce4680-84a8-11eb-84f4-62c8364c82ef.png)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /