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 458611e

Browse files
Update manager.py
1 parent 5a0fe28 commit 458611e

File tree

1 file changed

+14
-31
lines changed

1 file changed

+14
-31
lines changed

‎LinkedIn-Certifications-Manager/manager.py‎

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import argparse
1+
import getpass
22
from selenium import webdriver
33
from selenium.webdriver.common.keys import Keys
44
from selenium.webdriver.support.ui import WebDriverWait
@@ -56,48 +56,31 @@ def addCertData(self, name, org, credId, credUrl):
5656

5757

5858
if __name__ == "__main__":
59-
parser = argparse.ArgumentParser(
60-
description="Add your certifications to your LinkedIn Profile")
61-
group = parser.add_mutually_exclusive_group()
62-
63-
group.add_argument('-c', '--coursera', type=bool,
64-
help="Coursera certification", action='store_true')
65-
group.add_argument('-u', '--udemy', type=bool,
66-
help="Udemy certification", action='store_true')
67-
68-
args = parser.parse_args()
69-
70-
# set org according to arguments
71-
if args.udemy:
72-
org = 'udemy'
73-
elif args.coursera:
74-
org = 'coursera'
59+
# Get LinkedIn credentials
60+
email = input('Enter your linkedin email: ')
61+
password = getpass.getpass('Password: ')
7562

7663
# Chrome environment setup
7764
opt = webdriver.ChromeOptions()
7865
opt.add_argument('--disable-gpu')
79-
opt.add_argument('--headless')
66+
# opt.add_argument('--headless')
8067
driver = webdriver.Chrome(
8168
executable_path='LinkedIn-Certifications-Manager/chromedriver', options=opt)
8269
driver.get('https://linkedin.com')
8370

84-
# Get LinkedIn login credentials
85-
data = json.load(open('LinkedIn-Certifications-Manager/credentials.json'))
86-
87-
linkedIn = LinkedIn(data['linkedin']['email'],
88-
data['linkedin']['password'])
71+
linkedIn = LinkedIn(email, password)
8972
linkedIn.login()
9073

9174
# Load course data
9275
courseData = json.load(open('LinkedIn-Certifications-Manager/data.json'))
93-
items = courseData[org]
9476

9577
# Add certifications to linkedin
96-
for item in items:
97-
name = item['name']
98-
credId = item['url'].split('/')[-1]
99-
credUrl = item['url']
100-
linkedIn.addCertData(name=name, org=org,
101-
credId=credId, credUrl=credUrl)
102-
print(f'Added: {name}')
78+
for org in courseData:
79+
for course in range(len(courseData[org])):
80+
name = courseData[org][course]['name']
81+
credId = courseData[org][course]['url'].split('/')[-1]
82+
credUrl = courseData[org][course]['url']
83+
linkedIn.addCertData(name=name, org=org,
84+
credId=credId, credUrl=credUrl)
85+
print(f'Added: {name}')
10386
print('Completed!')

0 commit comments

Comments
(0)

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