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)
"MY_TOKEN_NAME", "username", "12345")
keyring.set_password(# get your passrd
"MY_TOKEN_NAME", "username")
keyring.get_password(# Out: 12345
This 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
= triton_session(
sess = "username",
username = keyring.get_password("MY_TOKEN_NAME", "username")
password
)# list available programs
= list_programs(sess)
programs # download program SRGA
= get_program(sess, program="SRGA")
df # list available baskets
= list_baskets(sess)
baskets # download basket ART-XC agns
= get_basket(sess, basket='ART-XC agns') df_basket
Working with https://www.srg.cosmos.ru/publications/
from srgweb.publications import get_srg_publications
# Get a list of publications
= get_srg_publications() publications