Skip to content


You must define 'CONTACTS_IMPORT_CALLBACK' in settings #1

mrbm opened this Issue · 1 comment

2 participants


I was trying to use this with pinax, but couldn't find any documentation stating what 'CONTACTS_IMPORT_CALLBACK' should be set to....any ideas? Or is this an error. Also of note as I noticed that the developers of this are involved with pinax...the bbauth seems to be in the process of being depreciated, so even after properly setting up an bbauth app, there is no app that has any permissions to interact with the 'contacts' of a yahoo account giving a 403 error. Look forward to hear the solution gentlemen. Good day.


You can't use BBAuth any more. It is deprecated. The pinax contact importer is kind of out of date.

django-contacts-import Google contact import works out of the box

For Yahoo, you need to go to Yahoo dev, create a new project with read access to Contacts.

django-contacts-import seems to assume that you already have a Yahoo Oauth done and have an access token. The Yahoo contact importer also has a strange dependency on django-oauth-access, but only for the Yahoo import and mostly for things that you can do pretty easily with oauth2 yourself.

If it helps anyone... Here is some code that I added to to add Yahoo Oauth. It is ugly, but maybe it can save you some time:

def yahoo_login(request, redirect_to=None):
    consumer = oauth.Consumer(settings.YAHOO_CONSUMER_KEY, settings.YAHOO_CONSUMER_SECRET)

    if request.GET == {}:
        client = oauth.Client(consumer)
        callback_url = ''
        request_token_url = ''

        resp, content = client.request(request_token_url, method="GET", callback_url=callback_url)

        response_dict = dict(cgi.parse_qsl(content))

        if ((str(resp['status']) != '200') or ('oauth_problem' in response_dict)):
            raise Exception("CANT GET REQUEST TOKEN"+str(response_dict))

        request.session['yahoo_token'] = response_dict

        authenticate_url = ''    

        url = "%s?oauth_callback=%s&oauth_token=%s" % (authenticate_url, callback_url, request.session['yahoo_token']['oauth_token'])
        return HttpResponseRedirect(url)
    elif request.GET['oauth_verifier'] != '':
        verifier = request.GET['oauth_verifier']
        token = oauth.Token(request.session['yahoo_token']['oauth_token'],request.session['yahoo_token']['oauth_token_secret'])
        client = oauth.Client(consumer, token)
        resp, content = client.request(access_token_url, "GET")
        if str(resp['status']) != '200':
            raise Exception("CANT GET ACCESS TOKEN")
        access_token = dict(cgi.parse_qsl(content))

        token = oauth.Token(access_token['oauth_token'], access_token['oauth_token_secret'])

        request.session['yahoo_token'] = token.to_string()

    if redirect_to is None:
        redirect_to = reverse("import_contacts")
    return HttpResponseRedirect(redirect_to)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.