Getting LinkedIn details Each field is prone to throw an exception if not found. If one element not found, then the next should be checked. I have put each element in a separate try/catch. Is this a correct approach or can it be optimized?

def getLinkedinDetails(self, gearman_worker, gearman_job):
    driver = webdriver.PhantomJS('/usr/local/bin/phantomjs')
    user_input = gearman_job.data
    user_input_list = user_input.split()
    if len(user_input_list) == 2:
        first = user_input_list[0]
        last = user_input_list[1]
    elif len(user_input_list) == 1:
        first = user_input_list[0]
        last = ''
    print "https://www.linkedin.com/pub/dir/?first="+first+"&amp;last="+last
    driver.get("https://www.linkedin.com/pub/dir/?first="+first+"&amp;last="+last)
    driver.set_window_size(1124, 850)
    try:
        wait = WebDriverWait(driver, 15)
        wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "content-wrapper")))
    except:
        "print timed out"
    final_result = []
    for s in driver.find_elements_by_class_name('vcard'):
        result = {}
        try:
            name = s.find_element_by_class_name('given-name').text
            result['name'] = name
            surname = s.find_element_by_class_name('family-name').text
            result['surname'] = surname
            fullname = name + ' ' + surname
            if user_input.strip() == user_input.strip():
                pass
            else:
                continue
            title = s.find_element_by_class_name('title').text
            result['title'] = title
            location = s.find_element_by_class_name('location').text
            result['location'] = location
            profile_url = s.find_element_by_tag_name('a').get_attribute('href')
            result['profile_url'] = profile_url
        except:
            pass
        try:
            industry = s.find_element_by_class_name('industry').text
            result['industry'] = industry
        except:
            pass
        try:
            current = s.find_element_by_class_name('current-content').text
            result['current'] = current
        except:
            pass
        try:
            past = s.find_element_by_class_name('past-content').text
            result['past'] = past
        except:
            pass
        try:
            education = s.find_element_by_class_name('education-content').text
            result['education'] = education
        except:
            pass
        try:
            img = s.find_element_by_class_name('photo').get_attribute('src')
            result['img'] = img
        except:
            pass
        print result
Proper error handling

Never, ever do something like this:

try:
    ...
except:
    ...


It's a horrible idea, for a couple of reasons:


It will catch every error, even the ones you don't want to catch.
Rare, nasty errors like a SystemError, will be caught, and ignored as well. Stuff like NameErrors, and even SyntaxErrors will be caught.
It's not very clear to the reader of your code, what you're trying to prevent.


For more info, see this Stackoverflow question.



Proper error logging

You have a lot of except: passes in your code. It's never helpful to the user, or even the programmer in some cases, if you don't get output when an error is caught. You could use the logging module, or write error output to a file, while informing the user in some way, that something went wrong.



Style

From looking at your code, you only appear to have two style violations:


Function names should be in snake_case.
Lines should be limited to 79/80 characters.


If you want to be sure, you can always check PEP8, Python's official style guide, to ensure that everything is correctly styled.