Where are the Google Admin SDK libraries? - google-admin-sdk

I would like to work with the Google Admin SDK and get information about our domain's email settings per user. I refer to Developer's Guide | Email Settings API
I am comfortable approaching the problem in Java, Python, and C# and all three languages have examples included in the documentation.
Where can I get all these libraries shown in the documentation?
C#
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
Java
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
Python
import gdata.apps.emailsettings.client

They are located here:
https://developers.google.com/admin-sdk/directory/v1/libraries
If you work through the Java QuickStart, these three imports aren't included and the provided quick start code won't compile.
import com.google.api.services.admin.directory.DirectoryScopes;
import com.google.api.services.admin.directory.model.*;
import com.google.api.services.admin.directory.Directory;
It seems the Java portion of this project is in need of an update.
Note the Maven and Gradle builds on the Java download page - https://developers.google.com/api-client-library/java/apis/admin/directory_v1 - show this error message:
This library is in the process of uploading to the central Maven repository. Please check back in a few hours.
I've seen that message there for a couple months now.

There are basically 2 kinds of APIs for Google Apps. The old style "GData" Atom based APIs and the new API Discovery Service compliant "Google APIs" (modern infra).
The Email Settings API is an old style GData API so you need the GData API client libraries.
The GData API client libraries are available for download from here:
https://developers.google.com/gdata/docs/client-libraries

Related

python-social-auth failure on Google App Engine

I am attempting to follow Tutorial: Adding Facebook/Twitter/Google Authentication to a Django Application. The only thing I am doing differently is that I am running DjangoAppEngine on the Google App Engine development server, otherwise everything is exactly as per the tutorial.
When I get to Step 4 and actually try to authenticate with Facebook, I am getting a runtime error:
error('illegal IP address string passed to inet_pton',)
Request Method: GET
Request URL: http://localtest.com:8080/o/complete/facebook/?redirect_state=FG4K...UG1k
Django Version: 1.6.11
Exception Type: RuntimeError
Exception Location: /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py in _MakeRealSyncCall, line 235
Python Executable: /usr/local/opt/python/bin/python2.7
Python Version: 2.7.11
Obviously FB is passing an approval back to my app, as the request URL includes the callback path.
It appears that something in the GoogleAppEngineLauncher is trying to look up an address and is not receiving the right data in? I'm not really sure.
In trying to resolve this, I've come across a single comment somewhere suggesting to a user that SimpleAuth might be a better way to go, but I don't understand why and I'm not really sure I want to start over if I am just missing something obvious.
Does anyone know why I am getting this error and what I can do to correct it?
It happens because the Facebook SDK depends on the awesome requests library. However, requests doesn't work on Google App Engine since the platform has some restrictions. You have to use their urlfetch APIs to fetch external contents on Google App Engine.
So yes, the official Facebook SDK won't work. You have to roll your own solution or find one that works. SimpleAuth is one of the solution that is known to have worked.
UPDATE: the original answer (starting with 'HOWEVER') is no longer necessary, just use requests 2.10.0 or above, urllib3 1.15.1 or above, and requests_toolbelt 0.6.2 or above and perform the following in your main():
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
HOWEVER if you're using older versions of requests and/or urllib3, then you need the patches below:
This can be accomplished using a patched version of requests along with the requests-toolbelt package. Threads that apply:
HTTPS not working on Google App Engine #1905
urllib3 / Contrib Modules / Google App Engine
Fixes the AppEngineManager to work within the requests framework #763
Add AppEngineAdapter for GAE users #114
Adds a monkeypatch() function that ensures all Sessions use the AppEngineAdapter compatibility class. #119
I've applied all of this and now have python-social-auth and facebook-sdk working in both local test (the dev server) and production (full App Engine).
In your vendored libraries, ensure that you have requests_toolbelt. (pip install -t lib requests_toolbelt). Then "monkeypatch" appengine support before python-social-auth ever calls requests. In my project/wsgi.py, I added the following lines:
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
python-social-auth depends on requests, so it should also exist in your vendor directory.
You must also ensure you are using requests version >= 2.10.0. This has not been released yet, so you can fake it. Edit lib/requests/__init__.py so that __build__ = 0x021000. You also must upgrade the packaged version of urllib3 in the lib/requests/packages/ directory to the latest version.
This is what worked for me.

Google API CPP Client - Using Service Account

Does the Google API CPP Client Library support Authorization using Service Account?
I could not find an example of how to use the Service Account when using the CPP Client library from https://github.com/google/google-api-cpp-client/
The sample available only demonstrate using Client Secret for installed application
flow_.reset(OAuth2AuthorizationFlow::MakeFlowFromClientSecretsPath( client_secrets_file, config_->NewDefaultTransportOrDie(), &status));
I've spend quite some time figuring this out. The harsh answer is no.
Compared to the Python or PHP version of this library, the CPP version is pretty much outdated.
A quick solution might be to fetch the required data from Google and write the result to a file using the Python client libraries. I.e. with std::system(). Then parse the file from your C++ application.

ImportError in Django Rest Framework with Google App Engine

I have develop a simple app to learn Django rest framework and then uploaded it into Google app engine. But each time I try to access my data it shows me "no module name rest_framework". it works ok if I dont use Google App engine and stop working if I use (both local install or deploy the codes). I am using django 1.4 and using Cloud SQL. Can anyone please tell me what might be the problem?
regards
Samin
screenshot:
A bit late but might help someone else, I was also trying to get a solution for this error then I came across this link which has all the thirdparty apps, google app engine support. It doesn't have rest_framework.
So a as a solution you will have to copy the third-party library's pure-Python source code into your application's source code.
here is a solution in detail.
Hope that helps!

Push OO or xslt doc to google drive from django

I use pod to generate reports from django. A very smart solution, I enjoy it.
But pod solution required an Open Office (or LibreOffice) installation on client desktop (or server side).
To avoid Open Office software I will hope to send report to google drive as a new (or existing) doc from a django app (or python ...).
Someone would to share expertise with this kind of issue? Else, What would be the steps to publish a google doc from django app?
If your Python app can produce a csv file, you can upload it to Google Docs using the Documents List API and convert it into a Spreadsheet:
https://developers.google.com/google-apps/documents-list/#creating_or_uploading_spreadsheets
Many other file formats can be imported, please check the docs for more details.

Consuming a web service with the Netbeans Platform

I have an application that is written with the NetBeans Platform 5.5. I'm having trouble consuming a web service.
If I create a Java SE application in NetBeans, I can add a web service reference without problem.
Since my application is using the NetBeans Platform, many of the menu choices change. So, I cannot figure out how to add a reference to the web service. I've googled this topic a number of ways but haven't found any pages that deal with consuming a service through the platform. They all talk about consuming a service with a Java SE application.
Changing the application from the Platform architecture is not an option.
Here is a good tutorial for setting up a Feed Reader on NetBeans Platform. It covers some of the configuration issues for using web services
Blog with an entry about making a web services client
I'd be happy to try and give you a more specific answer if you can give information about the service you want to access.
Found this:
Create web service and client using this tutorial
Create library wrapper module for web service client (you don't need to include JAX-WS libs, only your client jar)
In your wrapper module add following dependencies (important):
JAX-WS 2.1 API
JAX-WS 2.1 and JAXB 2.1 Library (for this you have to check Show Non-API Modules in "Add Module Dependency" window)
If you try to build module after these steps it will fail telling you that your module is not friend of "path-to-netbeans"/java2/modules/org-netbeans-modules-websvc-jaxws21.jar.
Right click on JAX-WS 2.1 and JAXB 2.1 Library and choose Edit. Select Implementation Version.
from here.