Skip to content
Snippets Groups Projects
Select Git revision
  • 5e31eeaa6bdca78f8f7ebc80ece952476ba208fb
  • main default protected
  • tickets/156
  • tickets/86
  • add_to_basket
5 results

esap-userprofile-python-client

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • Hugh Dickinson's avatar
    Hugh Dickinson authored
    Added chunked data download for Zooniverse client plugin. Incremented minor version number. Added installation instructions to README.
    5e31eeaa
    History

    esap-userprofile-python-client

    A Python client for the ESCAPE ESAP User Profile REST API.

    The shopping_client module, which communicates with the ESCAPE ESAP User Profile REST API is very lightweight. Archive-specific functionality is delegated to "connector" modules like the zooniverse module.

    Installation

    The client and the Zooniverse client cat be installed using pip:

    $ pip install git+https://git.astron.nl/astron-sdc/esap-userprofile-python-client.git

    Example - Using the Shopping Client with the Zooniverse connector

    from shopping_client import shopping_client
    from zooniverse import zooniverse
    import getpass
    
    # Prompt for Zooniverse account password
    zooniverse_password = getpass.getpass("Enter Zooniverse password:")
    
    # Instantiate Zooniverse connector
    zc = zooniverse(username="hughdickinson", password=zooniverse_password)
    
    # Instantiate ESAP User Profile shopping client, passing zooniverse connector
    sc = shopping_client(host="https://sdc-dev.astron.nl:5555/", connectors=[zc])
    
    # Retrieve basket (prompts to enter access token obtained from ESAP GUI)
    res=sc.get_basket(convert_to_pandas=True)
    
    # ... inspect available results ...
    
    # Retrieve data from Zooniverse based on basket item
    data = zc.retrieve(res["zooniverse"].loc[3],
                       generate=False,
                       wait=True,
                       convert_to_pandas=True)
    
    # ... analyse data ...