Skip to main content

Python client library to conveniently query the publication data of SRG/SSR

Project description

PDP GraphQL client Python

https://img.shields.io/pypi/v/pdp_graphql_client_python.svg https://img.shields.io/travis/SRGSSR/pdp_graphql_client_python.svg Documentation Status

Example repository of how to access PDP’s GraphQL API through python

USAGE

  1. create a .env file in the root directory file with the following Variables

    PDP_API=https://graphql-api.pdp.dev.srgssr.ch/graphql
    USER_NAME=[your_email]
    USER_PASSWORD=[your_password]
  2. then it should work, this is a simple code snippet to extract the data

    from sgqlc.types import Variable, non_null
    from sgqlc.operation import Operation
    from srgssr_publication_data_api import client, pdp_schema
    
    op = Operation(schema.Query, name='faroItems', variables={'first':non_null(int), 'after':str})
    
    # to restrict fields to just title and cursor (for pagination):
    selector = op.faro_items(first=Variable('first'), after=Variable('after'))
    selector.edges.title()
    selector.cursor()
    
    # if you just want to see the schema, just remove the selector.
    
    print(client.run_query(op, {'first': 100})['data'])
  3. for more details about building the queries, see also sgqlc usage docs (https://github.com/profusion/sgqlc#usage)

Development

For development check the documentation under docs/installation.rst.

Credits

This package was created with Cookiecutter and the elgertam/cookiecutter-pipenv project template, based on audreyr/cookiecutter-pypackage.

History

0.3.2 (2021-03-24)

  • Removed the dependency on Click

0.3.1 (2021-03-24)

  • Fixed typo in README.rst

  • Added missing dependency to sgqlc

0.3.0 (2021-03-23)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

srgssr-publication-data-api-0.3.2.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

srgssr_publication_data_api-0.3.2-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file srgssr-publication-data-api-0.3.2.tar.gz.

File metadata

  • Download URL: srgssr-publication-data-api-0.3.2.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

File hashes

Hashes for srgssr-publication-data-api-0.3.2.tar.gz
Algorithm Hash digest
SHA256 670f8ae2b70c469d9059da2eaa018bcabe234f8a844977a6d1dc637266d53644
MD5 4cbf7fbf1e44dfa11fe8cd4451dd593b
BLAKE2b-256 26a1eb2b8578b2b2fc76e17e2a89ca07abd4e2f2bce6d32342f36c206b59dd7a

See more details on using hashes here.

File details

Details for the file srgssr_publication_data_api-0.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: srgssr_publication_data_api-0.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

File hashes

Hashes for srgssr_publication_data_api-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 25aaed0c6e3ce9c09c0336d42313cf27eab182e9d2b8c1d9916c469fb48de863
MD5 bae9cd5064c00894b327c76dd043677d
BLAKE2b-256 94fd7166e02a8029f4a58eab336ee414612c32f426b3b73903392dc90febbe1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page