Skip to main content

API to access Transient Name Server (TNS) data

Project description

tns_api

API to access Transient Name Server (TNS) data

repo license Python Version PyPI DOI

Installation

It is recommended to install tns_api from pip:

pip install tns_api

or it can be installed from source in the usual way.

Usage Example

Below are some basic examples of what the user can do with this package.

Environmental Variables

First of all, you will need to set a .env file in the current directory with the following variables:

tns_id = 'YOUR_TNS_ID'
name = 'YOUR_BOT_NAME'
api_key = 'YOUR_API_KEY'

where the values for these can be obtained by creating a BOT (for mor information, check the TNS Help page).

Retrieving Properties

All the properties of an object can be obtained with a single line:

from tns_api import get_object
get_object('2004eo')
{'objname': '2004eo',
 'name_prefix': 'SN',
 'objid': 2980,
 'object_type': {'name': 'SN Ia', 'id': 3},
 'redshift': None,
 'ra': '20:32:54.190',
 'dec': '+09:55:42.71',
 'radeg': 308.22579,
 'decdeg': 9.92853,
 'radeg_err': None,
 'decdeg_err': None,
 'hostname': 'NGC 6928        ',
 'host_redshift': None,
 'internal_names': None,
 'discoverer_internal_name': None,
 'discoverydate': '2004-09-17 00:00:00.000',
 'discoverer': None,
 'reporter': None,
 'reporterid': None,
 'source': 'bot',
 'discoverymag': 17.8,
 'discmagfilter': {'id': None, 'name': None, 'family': None},
 'reporting_group': {'groupid': None, 'group_name': None},
 'discovery_data_source': {'groupid': None, 'group_name': None},
 'public': 1,
 'end_prop_period': None}

Contributing

To contribute, either open an issue or send a pull request (prefered option). You can also contact me directly (check my profile: https://github.com/temuller).

Citing TNS API

If you make use of this code, please cite it:

coming soon

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

tns_api-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

tns_api-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file tns_api-0.1.0.tar.gz.

File metadata

  • Download URL: tns_api-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tns_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7dead56ab420cb2597daf57cc18a726ca277106a301364369a5d3e6e3248613c
MD5 61f7532ff869246624d28c0efb44297a
BLAKE2b-256 c8e206a8874a5792c78e767b364b9b4dd173ed49649e0aca0725ca62d63f8c1a

See more details on using hashes here.

File details

Details for the file tns_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tns_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tns_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8e4db1dd5c54718f00a7f975b7ade0387f640ef21a44c160b4475f14311a97
MD5 5ac11eeb4d91a01bd59c63ec216cd3f3
BLAKE2b-256 0d13cd8d82a4df96393df94543a91224e3375c38459c29d9e678741c53b7d954

See more details on using hashes here.

Supported by

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