# srgweb Python client for SRG web services: triton and publications. ## Installation Install the latest version from the repository: ``` bash pip install git+https://github.com/uskovgs/srgweb/ ``` ## Working with https://www.srg.cosmos.ru/triton/ ```python 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](https://pypi.org/project/keyring/) package: ``` python # ! 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/ ``` python from srgweb.publications import get_srg_publications # Get a list of publications publications = get_srg_publications() ```