Skip to content

skyportal/skyportal_client

Repository files navigation

skyportal-client

SkyPortal provides an API to access most of its underlying functionality. To use it, you will need an API token. This can be generated via the web application from your profile page or, if you are an admin, you may use the system provisioned token stored inside of .tokens.yaml.

Accessing the SkyPortal API

Once you have a token, you may access SkyPortal programmatically as follows.

Python

import requests

token = 'ea70a5f0-b321-43c6-96a1-b2de225e0339'

def api(method, endpoint, data=None):
    headers = {'Authorization': f'token {token}'}
    response = requests.request(method, endpoint, json=data, headers=headers)
    return response

response = api('GET', 'http://localhost:5000/api/sysinfo')

print(f'HTTP code: {response.status_code}, {response.reason}')
if response.status_code in (200, 400):
    print(f'JSON response: {response.json()}')

Command line (curl)

curl -s -H 'Authorization: token ea70a5f0-b321-43c6-96a1-b2de225e0339' http://localhost:5000/api/sysinfo

Response

In the above examples, the SkyPortal server is located at http://localhost:5000. In case of success, the HTTP response is 200:

HTTP code: 200, OK
JSON response: {'status': 'success', 'data': {}, 'version': '0.9.dev0+git20200819.84c453a'}

On failure, it is 400; the JSON response has status=\"error\" with the reason for the failure given in message:

{
  \"status\": \"error\",
  \"message\": \"Invalid API endpoint\",
  \"data\": {},
  \"version\": \"0.9.1\"
}

Authentication

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.9.dev0+git20201221.76627dd
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/skyportal/skyportal_client.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/skyportal/skyportal_client.git)

Then import the package:

import skyportal_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import skyportal_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import skyportal_client
from pprint import pprint
from skyportal_client.api import acls_api
from skyportal_client.model.inline_object20 import InlineObject20
from skyportal_client.model.success import Success
# Defining the host is optional and defaults to https://fritz.science
# See configuration.py for a list of all supported configuration parameters.
configuration = skyportal_client.Configuration(
    host = "https://fritz.science"
)



# Enter a context with an instance of the API client
with skyportal_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = acls_api.AclsApi(api_client)
    user_id = 1 # int | 
acl_id = "acl_id_example" # str | 

    try:
        api_response = api_instance.api_user_user_id_acls_acl_id_delete(user_id, acl_id)
        pprint(api_response)
    except skyportal_client.ApiException as e:
        print("Exception when calling AclsApi->api_user_user_id_acls_acl_id_delete: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://fritz.science

Class Method HTTP request Description
AclsApi api_user_user_id_acls_acl_id_delete DELETE /api/user/user_id/acls/acl_id
AclsApi api_user_user_id_acls_ignored_args_post POST /api/user/user_id/acls/ignored_args
AllocationsApi api_allocation_allocation_id_delete DELETE /api/allocation/allocation_id
AllocationsApi api_allocation_allocation_id_get GET /api/allocation/allocation_id
AllocationsApi api_allocation_allocation_id_put PUT /api/allocation/allocation_id
AllocationsApi api_allocation_get GET /api/allocation
AllocationsApi api_allocation_post POST /api/allocation
AnnotationsApi api_annotation_annotation_id_delete DELETE /api/annotation/annotation_id
AnnotationsApi api_annotation_annotation_id_get GET /api/annotation/annotation_id
AnnotationsApi api_annotation_annotation_id_put PUT /api/annotation/annotation_id
AnnotationsApi api_annotation_post POST /api/annotation
AssignmentsApi api_assignment_assignment_id_delete DELETE /api/assignment/assignment_id
AssignmentsApi api_assignment_assignment_id_get GET /api/assignment/assignment_id
AssignmentsApi api_assignment_assignment_id_put PUT /api/assignment/assignment_id
AssignmentsApi api_assignment_get GET /api/assignment
AssignmentsApi api_assignment_post POST /api/assignment
CandidatesApi api_candidates_candidate_id_delete DELETE /api/candidates/candidate_id
CandidatesApi api_candidates_get GET /api/candidates
CandidatesApi api_candidates_obj_id_get GET /api/candidates/obj_id
CandidatesApi api_candidates_obj_id_head HEAD /api/candidates/obj_id
CandidatesApi api_candidates_post POST /api/candidates
ClassificationsApi api_classification_classification_id_delete DELETE /api/classification/classification_id
ClassificationsApi api_classification_classification_id_get GET /api/classification/classification_id
ClassificationsApi api_classification_classification_id_put PUT /api/classification/classification_id
ClassificationsApi api_classification_post POST /api/classification
ClassificationsApi api_sources_obj_id_classifications_get GET /api/sources/obj_id/classifications
CommentsApi api_comment_comment_id_attachment_get GET /api/comment/comment_id/attachment
CommentsApi api_comment_comment_id_attachment_pdf_get GET /api/comment/comment_id/attachment.pdf
CommentsApi api_comment_comment_id_delete DELETE /api/comment/comment_id
CommentsApi api_comment_comment_id_get GET /api/comment/comment_id
CommentsApi api_comment_comment_id_put PUT /api/comment/comment_id
CommentsApi api_comment_post POST /api/comment
DataSharingApi api_sharing_post POST /api/sharing
DefaultApi api_alerts_ztf_object_id_aux_get GET /api/alerts/ztf/objectId/aux
DefaultApi api_alerts_ztf_object_id_aux_post POST /api/alerts/ztf/objectId/aux
DefaultApi api_alerts_ztf_object_id_cutout_post POST /api/alerts/ztf/objectId/cutout
DefaultApi api_alerts_ztf_object_id_get GET /api/alerts/ztf/objectId
DefaultApi api_alerts_ztf_object_id_post POST /api/alerts/ztf/objectId
DefaultApi api_filters_filter_id_v_delete DELETE /api/filters/filter_id/v
DefaultApi api_filters_filter_id_v_get GET /api/filters/filter_id/v
DefaultApi api_filters_filter_id_v_patch PATCH /api/filters/filter_id/v
DefaultApi api_filters_filter_id_v_post POST /api/filters/filter_id/v
FacilityApi api_facility_post POST /api/facility
FiltersApi api_filters_filter_id_delete DELETE /api/filters/filter_id
FiltersApi api_filters_filter_id_get GET /api/filters/filter_id
FiltersApi api_filters_filter_id_patch PATCH /api/filters/filter_id
FiltersApi api_filters_get GET /api/filters
FiltersApi api_filters_post POST /api/filters
FollowupRequestsApi api_followup_request_followup_request_id_get GET /api/followup_request/followup_request_id
FollowupRequestsApi api_followup_request_get GET /api/followup_request
FollowupRequestsApi api_followup_request_post POST /api/followup_request
FollowupRequestsApi api_followup_request_request_id_delete DELETE /api/followup_request/request_id
FollowupRequestsApi api_followup_request_request_id_put PUT /api/followup_request/request_id
GroupAdmissionRequestsApi api_group_admission_requests_admission_request_id_delete DELETE /api/group_admission_requests/admission_request_id
GroupAdmissionRequestsApi api_group_admission_requests_admission_request_id_get GET /api/group_admission_requests/admission_request_id
GroupAdmissionRequestsApi api_group_admission_requests_admission_request_id_patch PATCH /api/group_admission_requests/admission_request_id
GroupAdmissionRequestsApi api_group_admission_requests_get GET /api/group_admission_requests
GroupAdmissionRequestsApi api_group_admission_requests_post POST /api/group_admission_requests
GroupsApi api_group_admission_requests_admission_request_id_delete DELETE /api/group_admission_requests/admission_request_id
GroupsApi api_group_admission_requests_admission_request_id_get GET /api/group_admission_requests/admission_request_id
GroupsApi api_group_admission_requests_admission_request_id_patch PATCH /api/group_admission_requests/admission_request_id
GroupsApi api_group_admission_requests_get GET /api/group_admission_requests
GroupsApi api_group_admission_requests_post POST /api/group_admission_requests
GroupsApi api_groups_get GET /api/groups
GroupsApi api_groups_group_id_delete DELETE /api/groups/group_id
GroupsApi api_groups_group_id_get GET /api/groups/group_id
GroupsApi api_groups_group_id_put PUT /api/groups/group_id
GroupsApi api_groups_group_id_streams_ignored_args_post POST /api/groups/group_id/streams/ignored_args
GroupsApi api_groups_group_id_streams_stream_id_delete DELETE /api/groups/group_id/streams/stream_id
GroupsApi api_groups_group_id_users_from_groups_ignored_args_post POST /api/groups/group_id/usersFromGroups/ignored_args
GroupsApi api_groups_group_id_users_ignored_args_patch PATCH /api/groups/group_id/users/ignored_args
GroupsApi api_groups_group_id_users_ignored_args_post POST /api/groups/group_id/users/ignored_args
GroupsApi api_groups_group_id_users_user_id_delete DELETE /api/groups/group_id/users/user_id
GroupsApi api_groups_post POST /api/groups
GroupsApi api_groups_public_get GET /api/groups/public
GroupsApi api_source_groups_obj_id_patch PATCH /api/source_groups/obj_id
GroupsApi api_source_groups_post POST /api/source_groups
GroupsApi api_sources_obj_id_groups_get GET /api/sources/obj_id/groups
InstrumentsApi api_instrument_get GET /api/instrument
InstrumentsApi api_instrument_instrument_id_delete DELETE /api/instrument/instrument_id
InstrumentsApi api_instrument_instrument_id_get GET /api/instrument/instrument_id
InstrumentsApi api_instrument_instrument_id_put PUT /api/instrument/instrument_id
InstrumentsApi api_instrument_post POST /api/instrument
InvitationsApi api_invitations_get GET /api/invitations
InvitationsApi api_invitations_invitation_id_delete DELETE /api/invitations/invitation_id
InvitationsApi api_invitations_invitation_id_patch PATCH /api/invitations/invitation_id
InvitationsApi api_invitations_post POST /api/invitations
LabApi api_alerts_ztf_object_id_cutout_get GET /api/alerts/ztf/objectId/cutout Serve ZTF alert cutout as fits or png
NewsFeedApi api_newsfeed_get GET /api/newsfeed
NotificationsApi api_source_notifications_post POST /api/source_notifications
ObservingRunsApi api_observing_run_get GET /api/observing_run
ObservingRunsApi api_observing_run_post POST /api/observing_run
ObservingRunsApi api_observing_run_run_id_delete DELETE /api/observing_run/run_id
ObservingRunsApi api_observing_run_run_id_get GET /api/observing_run/run_id
ObservingRunsApi api_observing_run_run_id_put PUT /api/observing_run/run_id
PhotometryApi api_photometry_bulk_delete_upload_id_delete DELETE /api/photometry/bulk_delete/upload_id
PhotometryApi api_photometry_photometry_id_delete DELETE /api/photometry/photometry_id
PhotometryApi api_photometry_photometry_id_get GET /api/photometry/photometry_id
PhotometryApi api_photometry_photometry_id_patch PATCH /api/photometry/photometry_id
PhotometryApi api_photometry_post POST /api/photometry
PhotometryApi api_photometry_put PUT /api/photometry
PhotometryApi api_photometry_range_get GET /api/photometry/range
PhotometryApi api_sources_obj_id_photometry_get GET /api/sources/obj_id/photometry
RolesApi api_roles_get GET /api/roles
RolesApi api_user_user_id_roles_ignored_args_post POST /api/user/user_id/roles/ignored_args
RolesApi api_user_user_id_roles_role_id_delete DELETE /api/user/user_id/roles/role_id
SourcesApi api_source_groups_obj_id_patch PATCH /api/source_groups/obj_id
SourcesApi api_source_groups_post POST /api/source_groups
SourcesApi api_sources_get GET /api/sources
SourcesApi api_sources_obj_id_delete DELETE /api/sources/obj_id
SourcesApi api_sources_obj_id_finder_get GET /api/sources/obj_id/finder
SourcesApi api_sources_obj_id_get GET /api/sources/obj_id
SourcesApi api_sources_obj_id_groups_get GET /api/sources/obj_id/groups
SourcesApi api_sources_obj_id_head HEAD /api/sources/obj_id
SourcesApi api_sources_obj_id_offsets_get GET /api/sources/obj_id/offsets
SourcesApi api_sources_obj_id_patch PATCH /api/sources/obj_id
SourcesApi api_sources_post POST /api/sources
SpectraApi api_sources_obj_id_spectra_get GET /api/sources/obj_id/spectra
SpectraApi api_spectrum_ascii_post POST /api/spectrum/ascii
SpectraApi api_spectrum_parse_ascii_post POST /api/spectrum/parse/ascii
SpectraApi api_spectrum_post POST /api/spectrum
SpectraApi api_spectrum_range_get GET /api/spectrum/range
SpectraApi api_spectrum_spectrum_id_delete DELETE /api/spectrum/spectrum_id
SpectraApi api_spectrum_spectrum_id_get GET /api/spectrum/spectrum_id
SpectraApi api_spectrum_spectrum_id_put PUT /api/spectrum/spectrum_id
StreamsApi api_groups_group_id_streams_ignored_args_post POST /api/groups/group_id/streams/ignored_args
StreamsApi api_groups_group_id_streams_stream_id_delete DELETE /api/groups/group_id/streams/stream_id
StreamsApi api_streams_get GET /api/streams
StreamsApi api_streams_post POST /api/streams
StreamsApi api_streams_stream_id_delete DELETE /api/streams/stream_id
StreamsApi api_streams_stream_id_get GET /api/streams/stream_id
StreamsApi api_streams_stream_id_patch PATCH /api/streams/stream_id
StreamsApi api_streams_stream_id_users_ignored_args_post POST /api/streams/stream_id/users/ignored_args
StreamsApi api_streams_stream_id_users_user_id_delete DELETE /api/streams/stream_id/users/user_id
SystemInfoApi api_sysinfo_get GET /api/sysinfo
TaxonomiesApi api_taxonomy_get GET /api/taxonomy
TaxonomiesApi api_taxonomy_post POST /api/taxonomy
TaxonomiesApi api_taxonomy_taxonomy_id_delete DELETE /api/taxonomy/taxonomy_id
TaxonomiesApi api_taxonomy_taxonomy_id_get GET /api/taxonomy/taxonomy_id
TelescopesApi api_telescope_get GET /api/telescope
TelescopesApi api_telescope_post POST /api/telescope
TelescopesApi api_telescope_telescope_id_delete DELETE /api/telescope/telescope_id
TelescopesApi api_telescope_telescope_id_get GET /api/telescope/telescope_id
TelescopesApi api_telescope_telescope_id_put PUT /api/telescope/telescope_id
TelescopesApi api_weather_get GET /api/weather
ThumbnailsApi api_thumbnail_post POST /api/thumbnail
ThumbnailsApi api_thumbnail_thumbnail_id_delete DELETE /api/thumbnail/thumbnail_id
ThumbnailsApi api_thumbnail_thumbnail_id_get GET /api/thumbnail/thumbnail_id
ThumbnailsApi api_thumbnail_thumbnail_id_put PUT /api/thumbnail/thumbnail_id
UsersApi api_group_admission_requests_admission_request_id_delete DELETE /api/group_admission_requests/admission_request_id
UsersApi api_group_admission_requests_admission_request_id_get GET /api/group_admission_requests/admission_request_id
UsersApi api_group_admission_requests_admission_request_id_patch PATCH /api/group_admission_requests/admission_request_id
UsersApi api_group_admission_requests_get GET /api/group_admission_requests
UsersApi api_group_admission_requests_post POST /api/group_admission_requests
UsersApi api_groups_group_id_users_from_groups_ignored_args_post POST /api/groups/group_id/usersFromGroups/ignored_args
UsersApi api_groups_group_id_users_ignored_args_patch PATCH /api/groups/group_id/users/ignored_args
UsersApi api_groups_group_id_users_ignored_args_post POST /api/groups/group_id/users/ignored_args
UsersApi api_groups_group_id_users_user_id_delete DELETE /api/groups/group_id/users/user_id
UsersApi api_streams_stream_id_users_ignored_args_post POST /api/streams/stream_id/users/ignored_args
UsersApi api_streams_stream_id_users_user_id_delete DELETE /api/streams/stream_id/users/user_id
UsersApi api_user_get GET /api/user
UsersApi api_user_post POST /api/user
UsersApi api_user_user_id_delete DELETE /api/user/user_id
UsersApi api_user_user_id_get GET /api/user/user_id
WeatherApi api_weather_get GET /api/weather

Documentation For Models

Documentation For Authorization

token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in skyportal_client.apis and skyportal_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from skyportal_client.api.default_api import DefaultApi
  • from skyportal_client.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import skyportal_client
from skyportal_client.apis import *
from skyportal_client.models import *

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages