Posts

One Drive python connection

redirect_uri = 'http://localhost:8000/' client_secret = 'your app password' client_id='app id' api_base_url='https://api.onedrive.com/v1.0/' scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']    client = onedrivesdk.get_default_client(     client_id=client_id, scopes=scopes) auth_url = client.auth_provider.get_auth_url(redirect_uri) #this will block until we have the code code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri) client.auth_provider.authenticate(code, redirect_uri, client_secret) print(client) f = onedrivesdk.Folder() i = onedrivesdk.Item() i.name = 'python' i.folder = f

Google Calendar api with django application

I have used google calendar api with django application. I have create some appointments on google calendar using django. There are  following steps to integrate with django application. 1. Firstly goes to this link google developer console      and then create a project and then create application 2.  save the client secret key and client id. 3.  Then go to your django application where you used calendar api 4. now install the library using command  <pip install google-api-python-client>then go to next step 5. I have used in my views.py example:-          from googleapiclient import discovery from oauth2client import tools from oauth2client.client import OAuth2WebServerFlow from oauth2client.file import Storage import httplib #--------------------------------------------------------------------------- # google_calendar_connection #----------------------------...

Google recaptcha integration with django applicaton

Recently I have used google recaptcha with my django application for registration process. There are following steps to integrate with your django application.  Firstly go to this link -  https://developers.google.com/recaptcha/   and click on get started. Now click on  add  sign up api keys for google recaptcha. enter label name (e.g.- Myapp) and domain(e.g. - localhost) for your local project and saved the recaptcha copy the site key and secret key and added into your settings for example       RECAPTCHA_PUBLIC_KEY = '6LdUAAAAAD97sRFALHoKmVWbHxE7kdXAUCed' RECAPTCHA_PRIVATE_KEY = '6LUAAAAAARB_-RRMI4ynXAw8mDC8fVUrDud'  one thing more add RECAPTCHA_VERIFICATION_URL =  'https://www.google.com/recaptcha/api/siteverify'   in settings.py file which are used in your forms. Then go to your template where you show recaptcha . and add this code in your template. <div class="g-recaptcha" data-sitekey="6Ld_EwkUAAAAADm...

retrive google contacts using google contactapi with django

Firstly we create  a project in google developer Console using following links: https://console.developers.google.com/home/dashboard?project=brickit-1134&pli=1 After create project click on side panel in google developer console and select "API MANAGER" and select google contact api and enable the api .After enable the api click on side pannel on "credentials" and click on add credentials. There are three options: 1. API key 2. OAuth 2.0 Client id 3. service account click on second options and go to consent screen and fill up the product name and save it after save click on web application and fill up the name and authorized redirect urls which is necessary "authorized redirect ur"l ==> your django application url where we redirect. After save it that generate a "client id" and "client secret" please save it. Now goes to your django application. install gdata in your virtualenv and paste code in your views: ...