Client¶
- class wwt_api_client.Client(api_base=None)[source]¶
Bases:
object
The main object for accessing the WWT web services.
Use this object to access the WWT APIs.
- Parameters:
- api_baseURL string or None
The base URL to use for accessing the WWT web APIs. Defaults to
DEFAULT_API_BASE
, which is probably equal to “http://www.worldwidetelescope.org”. The API base is configurable to make it possible to access testing servers, etc. This value should not end in a slash.
Attributes Summary
A
requests.Session
object used to talk to the WWT API server.Methods Summary
login
([user_guid, client_version, ...])Create a Login request object.
show_image
([image_url, name, credits, ...])Create a ShowImage request object.
tile_image
([image_url, credits, ...])Create a TileImage request object.
Attributes Documentation
- session¶
A
requests.Session
object used to talk to the WWT API server.
Methods Documentation
- login(user_guid='00000000-0000-0000-0000-000000000000', client_version='6.0.0.0', equinox_version_or_later=True)[source]¶
Create a Login request object.
Parameters are assigned to attributes of the return value; see
the class documentation
for descriptions.- Returns:
- requestan initialized
LoginRequest
object The request.
- requestan initialized
Examples
The arguments are for informational purposes only and so may be left at their defaults.
>>> from wwt_api_client import Client >>> req = Client().login() >>> info = req.send() # textual data about versions on server
- show_image(image_url=None, name=None, credits=None, credits_url=None, dec_deg=0.0, ra_deg=0.0, reverse_parity=False, rotation_deg=0.0, scale_arcsec=1.0, thumbnail_url=None, x_offset_pixels=0.0, y_offset_pixels=0.0)[source]¶
Create a ShowImage request object.
Parameters are assigned to attributes of the return value; see
the class documentation
for descriptions.- Returns:
- requestan initialized
ShowImageRequest
object The request.
- requestan initialized
Examples
The only two essential arguments are
image_url
andname
:>>> from wwt_api_client import Client >>> req = Client().show_image('http://example.com/space.jpg', 'My Image') >>> print(req.send()[:10]) # prints start of a WTML XML document <?xml vers
- tile_image(image_url=None, credits=None, credits_url=None, dec_deg=0.0, ra_deg=0.0, rotation_deg=0.0, scale_deg=1.0, thumbnail_url=None, x_offset_deg=0.0, y_offset_deg=0.0)[source]¶
Create a TileImage request object.
Parameters are assigned to attributes of the return value; see
the class documentation
for descriptions.- Returns:
- requestan initialized
TileImageRequest
object The request.
- requestan initialized
Examples
The only essential argument is
image_url
, if your image has appropriate AVM tags:>>> from wwt_api_client import Client >>> req = Client().tile_image('http://www.spitzer.caltech.edu/uploaded_files/images/0009/0848/sig12-011.jpg') >>> print(req.send()[:10]) # prints start of a WTML XML document <?xml vers