Skip to main content

Python SDK for Atlas API - A research cartography platform

Project description

Atlas Python SDK

Official Python SDK for the Atlas API

Installation

pip install wattslab-atlas

Quick Start

from wattslab_atlas import AtlasClient

# Initialize (auto-saves tokens for reuse)
client = AtlasClient()

# Login - uses saved token if available
client.login("your-email@example.com")

# First time? Validate the magic link from your email
# client.validate_magic_link("token-from-email")

# List features
features = client.list_features()
for f in features:
    print(f"{f.feature_name}: {f.feature_description}")

# List papers
papers = client.list_papers()
print(f"You have {papers.total_papers} papers")

Authentication

Atlas uses magic link authentication with automatic token storage:

First Time Setup

client = AtlasClient()

# Request magic link
client.login("user@example.com")
# >>> 📧 Magic link sent to user@example.com

# Check your email and validate
client.validate_magic_link("token-from-email")
# >>> ✓ Authentication successful! Token saved for future use.

Subsequent Logins

# Tokens are automatically reused
client = AtlasClient()
client.login("user@example.com")
# >>> ✓ Using stored credentials for user@example.com

Manual Token Management

# Disable auto-save if needed
client = AtlasClient(auto_save_token=False)

# Clear stored credentials
client.logout()
# >>> 🗑️ Cleared stored credentials.

Usage

Working with Features

from wattslab_atlas.models import FeatureCreate

# List all features
features = client.list_features()

# Create a feature
feature = FeatureCreate(
    feature_name="Sample Size",
    feature_description="Number of participants",
    feature_identifier="sample_size",
    feature_type="integer"
)
created = client.create_feature(feature)

# Delete a feature
client.delete_feature(feature_id)

Working with Papers

# List papers with pagination
papers = client.list_papers(page=1, page_size=10)

# Upload a paper
result = client.upload_paper(
    project_id="project-123",
    file_path="paper.pdf"
)
task_id = result['paper.pdf']

# Check upload status
status = client.check_task_status(task_id)

# Reprocess a paper
client.reprocess_paper(paper_id, project_id)

Managing Projects

# Get project features
features = client.get_project_features(project_id)

# Update project features
client.update_project_features(
    project_id,
    feature_ids=["feat1", "feat2"]
)

# Remove features from project
client.remove_project_features(
    project_id,
    feature_ids=["feat1"]
)

# Reprocess all papers in project
result = client.reprocess_project(project_id)
print(f"Reprocessing {result['total_papers']} papers")

Error Handling

from wattslab_atlas import AtlasClient, AuthenticationError, ResourceNotFoundError

client = AtlasClient()

try:
    features = client.list_features()
except AuthenticationError:
    print("Please login first")
    client.login("user@example.com")
except ResourceNotFoundError as e:
    print(f"Resource not found: {e}")

Requirements

  • Python 3.8+
  • Works in Jupyter notebooks
  • Works in regular Python scripts

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

wattslab_atlas-1.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wattslab_atlas-1.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file wattslab_atlas-1.1.0.tar.gz.

File metadata

  • Download URL: wattslab_atlas-1.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for wattslab_atlas-1.1.0.tar.gz
Algorithm Hash digest
SHA256 73b160157b6596432b6e29a78d2b03d0e084a5f0d49b9e4dffc9b3e7ba34f39f
MD5 657083b73a6b410ccc712015136bd6b8
BLAKE2b-256 56a12d83c13ee11d393fcc6bb962be3fea3ece57adb3c46bc4cf2892d1b8039a

See more details on using hashes here.

File details

Details for the file wattslab_atlas-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: wattslab_atlas-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for wattslab_atlas-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 875eb1ebd45ddf32be4bf8882384f92ca3a292e9530359752ce42b8209dc7cf2
MD5 3e8d01572594ff1c892c3536d095e3cf
BLAKE2b-256 c61970dc422be5cd6feb640fa59aea38b59eb4cb8cc2cc7d556ba060b0a07a45

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