Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cartodb/carto-auth
Python library to authenticate with CARTO
https://github.com/cartodb/carto-auth
auth bigquery carto carto-dw oauth
Last synced: 4 months ago
JSON representation
Python library to authenticate with CARTO
- Host: GitHub
- URL: https://github.com/cartodb/carto-auth
- Owner: CartoDB
- License: other
- Created: 2022-09-16T10:06:12.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T17:01:19.000Z (11 months ago)
- Last Synced: 2024-09-29T06:21:36.984Z (4 months ago)
- Topics: auth, bigquery, carto, carto-dw, oauth
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 1
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# carto-auth
[![PyPI version](https://badge.fury.io/py/carto-auth.svg)](https://badge.fury.io/py/carto-auth)
[![PyPI downloads](https://img.shields.io/pypi/dm/carto-auth.svg)](https://pypistats.org/packages/carto-auth)
[![Tests](https://github.com/cartodb/carto-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/cartodb/carto-auth/actions)Python library to authenticate with [CARTO](carto.com).
## Install
```bash
pip install carto-auth
```To install the CARTO DW extension:
```bash
pip install carto-auth[carto-dw]
```### Installing from source
```bash
git clone https://github.com/cartodb/carto-auth
cd carto-auth
pip install .
```## Usage
```py
from carto_auth import CartoAuth# Authentication
carto_auth = CartoAuth.from_oauth()
# carto_auth = CartoAuth.from_m2m("./carto_credentials.json")# Get api base url
api_base_url = carto_auth.get_api_base_url()# Get access token
access_token = carto_auth.get_access_token()# CARTO Data Warehouse
carto_dw_project, carto_dw_token = carto_auth.get_carto_dw_credentials()
carto_dw_client = carto_auth.get_carto_dw_client()
```For more information, check the [examples](./examples) section.
## Development
Make commands:
- init: create the environment and install dependencies
- lint: run linter (black + flake8)
- test: run tests (pytest)
- docs: build the documentation
- publish-pypi: publish package in pypi.org
- publish-test-pypi: publish package in test.pypi.org
- clean: remove the environmentCheck the development [documentation](./docs) section.
## Contributors
- [Jesús Arroyo](https://github.com/jesus89)
- [Valentin de la Cruz](https://github.com/vdelacruzb)
- [Óscar Ramírez](https://github.com/tuxskar)## Release
The release to PyPI requires an API token and setting the following file locally with the token: `~/.pypirc`
```
[distutils]
index-servers =
carto-auth[carto-auth]
repository = https://upload.pypi.org/legacy/
username = __token__
password =
```