2025-06-08 23:56:36 +03:00
2025-06-08 23:42:13 +03:00
2025-06-06 18:10:01 +03:00
2025-06-08 23:42:13 +03:00
2025-06-06 18:10:01 +03:00
2025-06-08 23:42:13 +03:00
2025-06-08 23:42:13 +03:00
2025-06-08 23:56:36 +03:00

srgweb

Python client for SRG web services: triton and publications.

Installation

Install the latest version from the repository:

pip install git+https://github.com/uskovgs/srgweb/
# or
pip install git+http://heagit.cosmos.ru/uskov/srgweb.git

Working with https://www.srg.cosmos.ru/triton/

from srgweb.triton import (
    triton_session, 
    list_programs, 
    get_program,
    list_baskets,
    get_basket
)

# login to triton
session = triton_session("username", "password")

# list available programs
programs = list_programs(session)

# download program "SRGA" (case insensitive)
df = get_program(session, program="srga")

# list available baskets
baskets = list_baskets(session)

# download basket ART-XC agns
df_basket = get_basket(session, basket='ART-XC agns')

To avoid entering your password in the terminal, you can store your token securely using the keyring package:

# ! pip install keyring
import keyring
# Save your token (one time)
keyring.set_password("MY_TOKEN_NAME", "username", "12345")

# Now you can use the keyring to get your password/token in your script
from srgweb.triton import triton_session
session = triton_session(
    username = "username", 
    password = keyring.get_password("MY_TOKEN_NAME", "username")
)

This way, your password/token is not stored in your scripts or visible in the terminal.

Working with https://www.srg.cosmos.ru/publications/

from srgweb.publications import get_srg_publications

# Get a list of publications
publications = get_srg_publications()
Description
Python client for internal SRG web services
Readme 58 KiB
Languages
Python 100%