Skip to main content

Python API to the MongoDB Atlas REST Interface

Project description

MongoDB Atlas - A Python API for MongoDB Atlas

The MongoDB database as a service offering Atlas provides a complete and well documented REST API.

Installation

The easiest way to install the mongodbatlas is with pip.

$ pip install mongodbatlas

Once the installation completes you can confirm it has worked by running

$ atlascli -h
usage: atlascli [-h] [--publickey PUBLICKEY] [--privatekey PRIVATEKEY] [--org]
                [--pause PAUSE_CLUSTER] [--resume RESUME_CLUSTER]
                [--list {projects,clusters}] [--cluster CLUSTER]
                [--project_id PROJECT_DETAIL] [--format {summary,full}]
                [--debug] [--resource RESOURCE] [--itemsperpage ITEMSPERPAGE]
                [--pagenum PAGENUM]

optional arguments:
  -h, --help            show this help message and exit
  --publickey PUBLICKEY
                        MongoDB Atlas public API key
  --privatekey PRIVATEKEY
                        MongoDB Atlas private API key
...

The Python Atlas API wraps the REST API in a more Pythonic API based around an AtlasAPI class.

The library assumes the existence of two environment variables:

  • ATLAS_PUBLIC_KEY : The public key value defined by the Atlas programmatic API key
  • ATLAS_PRIVATE_KEY : The private key defined by the Atlas programmatic API key.

See the section below on how to create a programmatic Atlas API key.

Usage

from mongodbatlas.api import AtlasAPI

ao

How to create an Atlas API Key

You can create keys at the Organization level by selecting the access menu item on the left hand side menu:

API Start Screen

Once you create a key you then need to assign it permissions. If you pick the default youwill have to add this key explicitly to every project that you want to manage via the API.

API Permissions Screen

On the next screen you can collect your API key. You will only get to see it once so please make sure to take a copy.

API Create Key Screen

Not on this screen we obliterate part of the key so it can't been seen.

Finally you need to whitelist any nodes that are going to originate API requests.

API Create Key Screen

You are now ready to start using your API key.

Using your keys

Both parts of the key required to acc

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

mongodbatlas-0.1.5.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file mongodbatlas-0.1.5.tar.gz.

File metadata

  • Download URL: mongodbatlas-0.1.5.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for mongodbatlas-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f68d87a0922a2e6e1c3a76509118a906ac66a0397757a557936d6d91fc0f3c86
MD5 6a8e94c96b4ef7985b25105f0d579c79
BLAKE2b-256 f7b2912d807933f1a05482f32b9311c4ab769832bfeb5c9f243015750ea11f91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page