srgweb
Python client for SRG web services
Installation
Install the latest version from the repository:
pip install git+https://github.com/uskovgs/srgweb/Working with https://www.srg.cosmos.ru/triton/
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")
# get your passrd
keyring.get_password("MY_TOKEN_NAME", "username")
# Out: 12345This way, your password/token is not stored in your scripts or visible in the terminal.
from srgweb.triton import (
triton_session,
list_programs,
get_program,
list_baskets,
get_basket
)
import keyring
# login to triton
sess = triton_session(
username = "username",
password = keyring.get_password("MY_TOKEN_NAME", "username")
)
# list available programs
programs = list_programs(sess)
# download program SRGA
df = get_program(sess, program="SRGA")
# list available baskets
baskets = list_baskets(sess)
# download basket ART-XC agns
df_basket = get_basket(sess, basket='ART-XC agns')Working with https://www.srg.cosmos.ru/publications/
from srgweb.publications import get_srg_publications
# Get a list of publications
publications = get_srg_publications()