Google python client used at Alkivi
Project description
python-alkivi-google-client
==========================
[](https://travis-ci.org/alkivi-sas/python-alkivi-google-client)
[](https://requires.io/github/alkivi-sas/python-alkivi-google-client/requirements/?branch=master)
Google python client used at Alkivi
## Package
Example
```python
from alkivi.google import client as google
import logging
scope = 'https://www.googleapis.com/auth/admin.directory.user.readonly'
# Using default configuration
google_client = google.Client(scopes=[scope])
# Using specific endpoint
google_client = google.Client(endpoint='account2')
# Get directory client for Admin SDK api
impersonate = 'toto@alkivi.fr'
directory_client = google_client.get_directory_client(impersonate)
# Get a gmail client for gmail API
gmail_client = google_client.get_gmail_client()
```
## Credentials
Credentials are fetched from, in priority order:
- ./google.conf (script directory)
- $HOME/.google.conf
- /etc/google.conf
Example
```ini
[default]
; general configuration: default endpoint
endpoint=account1
[account1]
; configuration specific to 'account1' endpoint
; using can be
; - service: for Service Account
; - oauth: for OAuth authentification
using=service
; for Service Account
service_account_key=/path/to_your_service_key.json
[account2]
; other account configuration
using=oauth
; for OAuth
client_id=your_client_id
client_secret=your_client_secret
refresh_token=your_refresh_token
```
## Tests
Testing is set up using [pytest](http://pytest.org) and coverage is handled
with the pytest-cov plugin.
Run your tests with ```py.test``` in the root directory.
Coverage is ran by default and is set in the ```pytest.ini``` file.
To see an html output of coverage open ```htmlcov/index.html``` after running the tests.
TODO
## Travis CI
There is a ```.travis.yml``` file that is set up to run your tests for python 2.7
and python 3.2, should you choose to use it.
TODO
==========================
[](https://travis-ci.org/alkivi-sas/python-alkivi-google-client)
[](https://requires.io/github/alkivi-sas/python-alkivi-google-client/requirements/?branch=master)
Google python client used at Alkivi
## Package
Example
```python
from alkivi.google import client as google
import logging
scope = 'https://www.googleapis.com/auth/admin.directory.user.readonly'
# Using default configuration
google_client = google.Client(scopes=[scope])
# Using specific endpoint
google_client = google.Client(endpoint='account2')
# Get directory client for Admin SDK api
impersonate = 'toto@alkivi.fr'
directory_client = google_client.get_directory_client(impersonate)
# Get a gmail client for gmail API
gmail_client = google_client.get_gmail_client()
```
## Credentials
Credentials are fetched from, in priority order:
- ./google.conf (script directory)
- $HOME/.google.conf
- /etc/google.conf
Example
```ini
[default]
; general configuration: default endpoint
endpoint=account1
[account1]
; configuration specific to 'account1' endpoint
; using can be
; - service: for Service Account
; - oauth: for OAuth authentification
using=service
; for Service Account
service_account_key=/path/to_your_service_key.json
[account2]
; other account configuration
using=oauth
; for OAuth
client_id=your_client_id
client_secret=your_client_secret
refresh_token=your_refresh_token
```
## Tests
Testing is set up using [pytest](http://pytest.org) and coverage is handled
with the pytest-cov plugin.
Run your tests with ```py.test``` in the root directory.
Coverage is ran by default and is set in the ```pytest.ini``` file.
To see an html output of coverage open ```htmlcov/index.html``` after running the tests.
TODO
## Travis CI
There is a ```.travis.yml``` file that is set up to run your tests for python 2.7
and python 3.2, should you choose to use it.
TODO
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alkivi-google-client-1.0.2.tar.gz.
File metadata
- Download URL: alkivi-google-client-1.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4745aea27a840e49386ec79fd2217cba7f6d9f9124be607023ab7f3282ad48f
|
|
| MD5 |
4eeff6a1b45e68e2c7faf29db3d2f8ae
|
|
| BLAKE2b-256 |
4f262a77f1ac94e6b1fce0cd427514bf0b40f98a91bea0909b55bf16f2389721
|
File details
Details for the file alkivi_google_client-1.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: alkivi_google_client-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88e03a2e0d66fb4d2e33d9440875b2fc44a6c510f509aa14ddcecea410cc41db
|
|
| MD5 |
6ace782eaf8c8cea39d02250c2ee31cb
|
|
| BLAKE2b-256 |
83dcccb857816d51ee8f978319e4f4d8b2493ea88041a13425a67a1a704013ab
|