Skip to main content

A Python client library for the ShopVirge API

Project description

shopvirge-client

A Python client library for the ShopVirge API, auto-generated from the OpenAPI specification using openapi-python-client.

Installation

pip install shopvirge-client

Quick Start

Unauthenticated requests

from shopvirge_client import Client

# Uses https://api.shopvirge.com by default
client = Client()

# Or point to a different environment
client = Client(base_url="https://staging-api.shopvirge.com")

Authentication

Most endpoints require authentication via an OAuth2 access token. First, obtain a token:

from shopvirge_client import Client, AuthenticatedClient
from shopvirge_client.api.login import login_access_token_login_access_token_post as login
from shopvirge_client.models import BodyLoginAccessTokenLoginAccessTokenPost

# Get an access token
client = Client()
credentials = BodyLoginAccessTokenLoginAccessTokenPost(
    username="user@example.com",
    password="your-password",
)
response = login.sync(client=client, body=credentials)
token = response["access_token"]

# Create an authenticated client
auth_client = AuthenticatedClient(token=token)

Making API calls

Every API endpoint has four functions:

  • sync() — make a synchronous request, return the parsed response
  • sync_detailed() — make a synchronous request, return a Response object with status code, headers, and parsed body
  • asyncio() — async version of sync()
  • asyncio_detailed() — async version of sync_detailed()

List shops

from shopvirge_client.api.shops import get_multi_shops_get

shops = get_multi_shops_get.sync(client=auth_client)

Get a specific shop

from shopvirge_client.api.shops import get_by_id_shops_id_get

shop = get_by_id_shops_id_get.sync(id="shop-uuid", client=auth_client)

Create an order

from shopvirge_client.api.orders import create_orders_post
from shopvirge_client.models import OrderCreate

order = OrderCreate(
    shop_id="shop-uuid",
    # ... other fields
)
result = create_orders_post.sync(client=auth_client, body=order)

List products for a shop

from shopvirge_client.api.shops import create_shops_shop_id_products_post

# Products, categories, tags, and attributes are all scoped under a shop

Async usage

import asyncio
from shopvirge_client import AuthenticatedClient
from shopvirge_client.api.shops import get_multi_shops_get

async def main():
    async with AuthenticatedClient(token="your-token") as client:
        shops = await get_multi_shops_get.asyncio(client=client)
        print(shops)

asyncio.run(main())

Custom base URL

By default the client points to https://api.shopvirge.com. Override it for local development or staging:

from shopvirge_client import Client, AuthenticatedClient

# Local development
client = Client(base_url="http://localhost:8000")

# Staging
auth_client = AuthenticatedClient(
    base_url="https://staging-api.shopvirge.com",
    token="your-token",
)

Advanced configuration

import httpx
from shopvirge_client import Client

client = Client(
    base_url="https://api.shopvirge.com",
    timeout=httpx.Timeout(30.0),
    follow_redirects=True,
    headers={"X-Custom-Header": "value"},
    cookies={"session": "abc123"},
    raise_on_unexpected_status=True,
)

Available API modules

Module Description
api.login Authentication (login, token test, password recovery)
api.users User management
api.shops Shop CRUD, configuration, products, categories, tags, attributes, prices
api.orders Order management
api.licenses License management
api.downloads File downloads
api.forms Form submissions
api.faq FAQ management
api.images Image uploads (signed URLs)
api.stripe Stripe payment integration
api.early_access Early access signups

License

MIT

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

shopvirge_client-0.2.2.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

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

shopvirge_client-0.2.2-py3-none-any.whl (259.9 kB view details)

Uploaded Python 3

File details

Details for the file shopvirge_client-0.2.2.tar.gz.

File metadata

  • Download URL: shopvirge_client-0.2.2.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shopvirge_client-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7e60af15ec469466d0ea380221d462370f8a4edc1032590bd70e7bacf1d6dc89
MD5 58ea0d63d7f77e0d705b805c0d9ff329
BLAKE2b-256 396e9a24c22904a9ea272b2dad4cc40389d9a7aeb5b1134d831575c46acc506f

See more details on using hashes here.

Provenance

The following attestation bundles were made for shopvirge_client-0.2.2.tar.gz:

Publisher: publish.yml on acidjunk/shopvirge-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shopvirge_client-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for shopvirge_client-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ebc9098afb9145e5289d809e52757433d9427c7d2bd7d0a4ad3d93082a53aef
MD5 313037cb3fb77b5ac850298a1557d2c6
BLAKE2b-256 432f56de9d6d7c37d31c46c22bed0a0edfb3e62e9612c2f562865ec36c2ba766

See more details on using hashes here.

Provenance

The following attestation bundles were made for shopvirge_client-0.2.2-py3-none-any.whl:

Publisher: publish.yml on acidjunk/shopvirge-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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