add examples to readme
This commit is contained in:
parent
1c66157b68
commit
320595a948
43
README.md
43
README.md
@ -1 +1,42 @@
|
||||
# srgweb
|
||||
# srgweb: Python client for SRG web services
|
||||
|
||||
## 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
|
||||
)
|
||||
import keyring
|
||||
|
||||
# login to triton
|
||||
sess = triton_session("uskov", keyring.get_password("PLAN_SRG", ""))
|
||||
# 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/
|
||||
|
||||
```python
|
||||
from srgweb.publications import get_srg_publications
|
||||
|
||||
# Get a list of publications
|
||||
publications = get_srg_publications()
|
||||
```
|
11
examples.py
11
examples.py
@ -19,6 +19,14 @@ baskets = list_baskets(sess)
|
||||
df_basket = get_basket(sess, basket='ART-XC agns')
|
||||
|
||||
|
||||
|
||||
|
||||
# Publications
|
||||
|
||||
from srgweb.publications import get_df_from_srg_papers
|
||||
|
||||
df = get_df_from_srg_papers()
|
||||
|
||||
from srgweb.artsurvey import (
|
||||
artsurvey_session,
|
||||
get_artsurvey_cat
|
||||
@ -110,4 +118,5 @@ resp = sess.post(
|
||||
from urllib.parse import urlencode
|
||||
print(urlencode(payload, doseq=True))
|
||||
|
||||
resp.raise_for_status()
|
||||
resp.raise_for_status()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user