GetCommunityInfoRequest

class wwt_api_client.communities.GetCommunityInfoRequest(communities_client)[source]

Bases: wwt_api_client.communities.CommunitiesAPIRequest

Get information about the specified community.

The response is JSON, looking like:

{
  "community": {
    "MemberCount": 0,
    "ViewCount": 6,
    "ShareUrl": null,
    "Description": "Testing community",
    "LastUpdated": "44 minutes ago",
    "ActionUrl": null,
    "IsOffensive": false,
    "Id": 610180,
    "Name": "PKGW Test",
    "Category": 20,
    "ParentId": 610131,
    "ParentName": "None",
    "ParentType": 3,
    "Tags": "testtag",
    "Rating": 0,
    "RatedPeople": 0,
    "ThumbnailID": "00000000-0000-0000-0000-000000000000",
    "Entity": 1,
    "FileName": null,
    "ContentAzureID": null,
    "UserPermission": 63,
    "AccessType": 2,
    "Producer": "Peter Williams ",
    "ProducerId": 609582,
    "ContentType": 0,
    "DistributedBy": null
  },
  "permission": {
    "Result": {
      "CurrentUserPermission": 63,
      "PermissionItemList": [
        {
          "Comment": null,
          "Date": "/Date(1585273889157)/",
          "Requested": "44 minutes ago",
          "CommunityId": 610180,
          "CommunityName": "PKGW Test",
          "CurrentUserRole": 5,
          "IsInherited": true,
          "CanShowEditLink": false,
          "CanShowDeleteLink": false,
          "Id": 609582,
          "Name": "Peter Williams ",
          "Role": 5
        }
      ],
      "PaginationDetails": {
        "ItemsPerPage": 8,
        "CurrentPage": 0,
        "TotalPages": 1,
        "TotalCount": 1
      },
      "SelectedPermissionsTab": 1
    },
    "Id": 4,
    "Exception": null,
    "Status": 5,
    "IsCanceled": false,
    "IsCompleted": true,
    "CreationOptions": 0,
    "AsyncState": null,
    "IsFaulted": false
  }
}
Attributes
id

Methods

invalidity_reason(self)

Check whether the parameters of this request are valid.

make_request(self)

Generate a requests.Request from the current parameters.

send(self[, raw_response])

Issue the request and return its result.

to_text(self)

Issue the request and return its results as text.

to_xml(self)

Issue the request and return its results as parsed XML.

Attributes Summary

id

The ID number of the community to probe

Methods Summary

invalidity_reason(self)

Check whether the parameters of this request are valid.

make_request(self)

Generate a requests.Request from the current parameters.

Attributes Documentation

id = None

The ID number of the community to probe

Methods Documentation

invalidity_reason(self)[source]

Check whether the parameters of this request are valid.

Returns
reasonstring or None

If None, indicates that this request is valid. Otherwise, the returned string explains what about the request’ parameters is invalid.

Examples

You can manually check if a request is correctly set up:

>>> from wwt_api_client import Client
>>> req = Client().show_image('http://example.com/space.jpg', 'My Image')
>>> assert req.invalidity_reason() is None
make_request(self)[source]

Generate a requests.Request from the current parameters.

This method returns a requests.Request object ready for sending to the API server.

Returns
requestrequests.Request object

The HTTP request.

Examples

Get the URL that will be accessed for a request:

>>> from six.moves.urllib.parse import urlparse
>>> from wwt_api_client import Client
>>> req = Client().show_image('http://example.com/space.jpg', 'My Image')
>>> parsed_url = urlparse(req.make_request().prepare().url)
>>> print(parsed_url.path)
/WWTWeb/ShowImage.aspx