TypePad Content Objects

The typepad.api module contains TypePadObject implementations of all the content objects provided in the TypePad API.

class typepad.api.Application(**kwargs)

An application that can authenticate to the TypePad API using OAuth.

An application is identified by its OAuth consumer key, which in the case of a hosted group is the same as the identifier for the group itself.

browser_upload_endpoint
The endpoint to use for uploading file assets directly to TypePad.
classmethod get_by_api_key(api_key, **kwargs)

Returns an Application instance by the API key.

Asserts that the api_key parameter matches ^w+$.

id
A URI that uniquely identifies this Application.
name
The name of this Application as configured by the developer.
oauth_access_token_url
The service URL from which to request the OAuth access token.
oauth_authorization_url
The URL at which end users can authorize the application to access their accounts.
oauth_identification_url
The URL at which end users can identify themselves to sign into typepad, thereby signing into this site.
oauth_request_token_url
The service URL from which to request the OAuth request token.
session_sync_script_url
The URL from which to request session sync javascript.
signout_url
The URL at which end users can sign out of TypePad.
url_id
The canonical identifier used to identify this Application in URLs.
user_flyouts_script_url
The URL from which to request typepad user flyout javascript.
class typepad.api.Asset(**kwargs)

An item of content generated by a user.

actor

This asset’s author.

This alias lets us use Asset instances interchangeably with Event instances in templates.

asset_ref
An AssetRef instance representing this asset.
author
The User who created the Asset.
categories
A list of Tag instances associated with the Asset.
comment_count
The number of comments left on this Asset instance.
comments()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

content
For a text type of Asset, the HTML content of the Asset.
crosspost_accounts
A list of elsewhere account IDs to crosspost to.
favorite_count
The number of times this Asset instance has been marked as a favorite.
favorites()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

classmethod get_by_id(id, **kwargs)

Returns an Asset instance by the identifier for the asset.

Asserts that the url_id parameter matches ^w+$.

classmethod get_by_url_id(url_id, **kwargs)

Returns an Asset instance by the url id for the asset.

Asserts that the url_id parameter matches ^w+$.

groups

A field representing a homogeneous list of data.

The elements of the list are decoded through another field specified when the List is declared.

id
A URI that uniquely identifies this Asset.
in_reply_to
For comment Asset instances, an AssetRef describing the asset on which this instance is a comment.

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

published
A datetime.datetime indicating when the Asset was created.
rendered_content
The content of this asset rendered to HTML. This is currently available only for Post and Page assets.
source
If the Asset instance was imported from another service, a Source instance describing the original asset on the external service.
status
The PublicationStatus describing the state of the Asset.
summary
For a media type of Asset, the HTML description or caption given by its author.
text_format

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

title

The title of the asset as provided by its author.

For some types of asset, the title may be an empty string. This indicates the asset has no title.

updated
A datetime.datetime indicating when the Asset was last modified.
url_id
An identifier for this Asset that can be used in URLs.
class typepad.api.AssetRef(**kwargs)

A structure that refers to an asset without including its full content.

author
The User who created the referenced asset.
href
The URL at which a representation of the corresponding asset can be retrieved.
reclass_for_data(data)

Returns False.

This method prevents AssetRef instances from being reclassed when updated from a data dictionary based on the dictionary’s objectTypes member.

ref

A URI that uniquely identifies the referenced Asset.

The URI matches the one in the referenced Asset instance’s id field.

type
The MIME type of the representation available from the href URL.
url_id

An identifier for this Asset that can be used in URLs.

The identifier matches the one in the referenced Asset instance’s url_id.

class typepad.api.Audio(**kwargs)

An entry in a blog.

A field representing a nested DataObject.

A link to an audio recording.

duration
The duration of the audio stream in seconds.
url
The URL to the MP3 representation of the audio stream.
class typepad.api.Comment(**kwargs)
A text comment posted in reply to some other asset.
class typepad.api.Document(**kwargs)
A shared link to some URL.
class typepad.api.ElsewhereAccount(**kwargs)

A user account on an external website.

crosspostable
Boolean for whether or not this account supports cross-posting.
domain
The DNS domain of the site to which the account belongs.
id

A unique identifier for this elsewhere account.

Used when issuing a cross-post to the elsewhere account.

provider_icon_url
The URL of a 16 by 16 pixel icon representing the service providing this account.
provider_name
The name of the service providing this account, suitable for presentation to human viewers.
provider_url
The URL of the home page of the service providing this account.
url
The URL of the corresponding profile page on the service’s web site, if known.
user_id
The primary identifier of the account, if known.
username

The username of the account, if known and appropriate.

Some services don’t have username attributes, only user_id attributes.

class typepad.api.Event(**kwargs)

An action that a user or group did.

An event has an actor, which is the user or group that did the action; a set of verbs that describe what kind of action occured; and an object that is the object that the action was done to. In the current TypePad API implementation, only assets, users and groups can be the object of an event.

actor

The entity (User or Group) that performed the described Event.

For example, if the Event represents someone joining a group, actor would be the User who joined the group.

id
A URI that uniquely identifies this Event.
object

The object (a User, Group, or Asset) that is the target of the described Event.

For example, if the Event represents someone joining a group, object would be the group the User joined.

published
A field representing a timestamp.
url_id
An identifier for this Event that can be used in URLs.
verbs

A list of URIs describing what this Event describes.

For example, if the Event represents someone joining a group, verbs would contain the one URI tag:api.typepad.com,2009:JoinedGroup.

class typepad.api.Favorite(**kwargs)

A favorite of some other asset.

Asserts that the user_id and asset_id parameter match ^w+$.

class typepad.api.Group(**kwargs)

A group that users can join, and to which users can post assets.

TypePad API social applications are represented as groups.

assets()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

audio_assets()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

comments()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

display_name

The name chosen for the Group for display purposes.

Use this name when displaying the Group‘s name in link text or other text for human viewing.

events()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

classmethod get_by_id(id, **kwargs)

Returns a Group instance by their unique identifier.

Asserts that the id parameter is valid.

classmethod get_by_url_id(url_id, **kwargs)

Returns a Group instance by the group’s url identifier.

Asserts that the url_id parameter matches ^w+$.

id

A URI that uniquely identifies this Group.

A group’s id URI is unique across groups, TypePad environments, and time. When associating local content with a group, use this identifier as the “foreign key” to an API group.

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

memberships()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

photo_assets()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

post_assets()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

tagline
The tagline or subtitle of this Group.
url_id

An identifier for this Group that can be used in URLs.

A group’s url_id is unique in only one TypePad environment, so you should use id, not url_id, to associate data with a Group. When constructing URLs to API resources in a given TypePad environment, however, use url_id.

urls

A field representing a homogeneous list of data.

The elements of the list are decoded through another field specified when the List is declared.

video_assets()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

A link to an image.

Images hosted by TypePad can be resized with image sizing specs. See the url_template field and at_size method.

at_size(spec)

Returns the URL for the image at size given by spec.

You can request images from TypePad in several sizes, using an image sizing spec. For example, the image spec pi means the original size of the image, whereas 75si means a 75 pixel square.

If spec is not a valid image sizing spec, this method raises a ValueError.

by_height(size)

Given a size, return an ImageLink of an image that is no taller than the requested size.

This mode scales the image such that the height is the size specified in the spec, and the width is scaled to maintain the image’s aspect ratio.

by_width(size)

Given a size, return an ImageLink of an image that is no wider than the requested size.

This mode scales the image such that the width is the size specified in the spec, and the height is scaled to maintain the image’s aspect ratio.

height
The natural height of the original image in pixels.
inscribe(size)

Given a size, return an ImageLink of an image that is no taller or wider than the requested size.

This mode takes the largest dimension (either width or height) and scales the image so that dimension is the size specified in the spec. The other dimension is scaled to maintain the image’s aspect ratio.

square(size)

Given a size, return an ImageLink of an image that fits within a square of the requested size.

This results in a square image whose width and height are both the size specified. If the original image isn’t square, the image is cropped across its longest dimension, showing only the central portion which fits inside the square.

url
The URL for the original full-size version of the image.
url_template

If TypePad is able to scale the image, the URL template for making resized image URLs.

The URL template is combined with an image sizing spec to provide an URL to the same image at a different size.

Only images hosted on TypePad are available in multiple sizes. Images such as Facebook and Twitter userpics are only available in one size. If an image is not resizable, its url_template will be None.

valid_specs
A set of all known valid image sizing specs.
width
The natural width of the original image in pixels.
class typepad.api.LinkAsset(**kwargs)

A shared link to some URL.

target_url

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

class typepad.api.Photo(**kwargs)

An entry in a blog.

A field representing a nested DataObject.
class typepad.api.Post(**kwargs)
An entry in a blog.
class typepad.api.Provider(**kwargs)

An external service that provided an asset.

icon
The URL for a 16 by 16 favicon for the external service.
name
The name of the external service.
uri
The main URL for the external service.
class typepad.api.PublicationStatus(**kwargs)

A container for the flags that represent an asset’s publication status.

Publication status is currently represented by two flags: published and spam. The published flag is false when an asset is held for moderation, and can be set to true to publish the asset. The spam flag is true when TypePad’s spam filter has determined that an asset is spam, or when the asset has been marked as spam by a moderator.

published
A boolean flag indicating whether the Asset with this PublicationStatus is available for public viewing (True) or held for moderation (False).
spam
A boolean flag indicating whether the Asset with this PublicationStatus has been marked as spam by the automated filter or a site moderator (True) or not (False).
class typepad.api.Relationship(**kwargs)

The unidirectional relationship between a pair of entities.

A Relationship can be between a user and a user (a contact relationship), or a user and a group (a membership). In either case, the relationship’s status shows all the unidirectional relationships between the source and target entities.

created

A field representing a homogeneous mapping of data.

The elements of the mapping are decoded through another field specified when the Dict is declared.

id
A URI that uniquely identifies this Relationship instance.
source
The entity (User or Group) from which this Relationship arises.
status
A RelationshipStatus describing the types of relationship this Relationship instance represents.
status_obj()

A RelationshipStatus describing the types of relationship this Relationship instance represents.

Unlike the RelationshipStatus instance in the status field, this linked RelationshipsStatus instance can be updated through POST requests.

target
The entity (User or Group) that is the object of this Relationship.
url_id
An identifier for this Relationship that can be used in URLs.
class typepad.api.RelationshipStatus(**kwargs)

A representation of just the relationship types of a relationship, without the associated endpoints.

types
A list of URIs instances that describe all the relationship edges included in this RelationshipStatus.
class typepad.api.Source(**kwargs)

Information about an Asset instance imported from another service.

by_user

Whether the associated asset was created on the external service by the TypePad asset’s author, as opposed to imported by that TypePad user.

For example, a YouTube video asset that the TypePad user created would have a by_user of True. If the TypePad user instead posted someone else’s YouTube video, by_user would be False. (As far as TypePad is concerned, the TypePad user who posted it is the asset’s author in either case.)

The original URL of the imported asset on the external service.
provider
Description of the external service that provided the associated asset.
source

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

class typepad.api.Tag(**kwargs)

A textual tag applied to an asset by its author.

count

The number of times the Tag has been used in the requested context.

When returned in the list of tags for a group, the count is the number of times the Tag has been used for assets in that group. When returned in the list of tags for a User, the count is the number of times the tag has been used on that author’s assets. When returned in the list of tags for an Asset, the count is 1 if the tag has been applied to that asset.

term
The word or phrase that constitutes the tag.
class typepad.api.User(**kwargs)

A TypePad user.

This includes those who own TypePad blogs, those who use TypePad Connect and registered commenters who have either created a TypePad account or signed in with OpenID.

The Link instance to the user’s avatar picture.
comments()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

display_name

The name chosen by the User for display purposes.

Use this name when displaying the User‘s name in link text or other text for human viewing.

elsewhere_accounts()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

email

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

events()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

favorites()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

gender

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

classmethod get_by_id(id, **kwargs)

Returns a User instance by their unique identifier.

Asserts that the id parameter is valid.

classmethod get_by_url_id(url_id, **kwargs)

Returns a User instance by their url identifier.

Profile URL identifiers must contain only letters, numbers, and underscores.

classmethod get_self(**kwargs)
Returns a User instance representing the account as whom the client library is authenticating.
id

A URI that uniquely identifies this User.

A user’s id URI is unique across groups, TypePad environments, and time. When associating local content to a user, use this identifier as the “foreign key” to an API user.

memberships()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

notifications()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

preferred_username

The identifying part of the User‘s chosen TypePad Profile URL.

This identifier is unique across groups, but not across TypePad environments. TypePad users can change their Profile URLs, so this identifier can also change over time for a given user. Use this name when constructing a link to the user’s profile on your local site. (Use the User instance’s profile_page_url field for the full TypePad Profile URL.)

profile_page_url
The URL of the user’s TypePad profile page.
relationships()

A TypePadObject property representing a link from one TypePad API object to another.

This Link works like remoteobjects.fields.Link, but builds links using the TypePad API URL scheme. That is, a Link on /asset/1.json called events links to /asset/1/events.json.

url_id

An identifier for this User that can be used in URLs.

A user’s url_id is unique only across groups in one TypePad environment, so you should use id, not url_id, to associate data with a User. When constructing URLs to API resources in one particular TypePad environment, however, use url_id.

class typepad.api.UserProfile(**kwargs)

Additional profile information about a TypePad user.

This additional information is useful when showing information about a TypePad account directly, but is generally not required when linking to an ancillary TypePad account, such as the author of a post.

about_me

The biographical text provided by the User.

This text is displayed on the user’s TypePad Profile page. The string may contain multiple lines of text separated by newline characters.

The Link instance to the related user’s avatar picture.
display_name
The related user’s chosen display name.
email

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

follow_frame_content_url

The URL of the related user’s following widget.

Use this URL in an HTML iframe to provide an interface for following this user. The iframe should be 300 pixels wide and 125 pixels high.

gender

A property for encoding object attributes as dictionary values and decoding dictionary values into object attributes.

Declare a Field instance for each attribute of a DataObject that should be encoded to or decoded from a dictionary.

Use a Field instance directly for simple DataObject attributes that can be the same type as their dictionary values. That is, use Field fields for strings, numbers, and boolean values. If your attribute data does need converted, use one of the Field subclasses from the remoteobjects.fields module to encode and decode your data as appropriate.

If your attribute needs converted specially, override the decode() and encode() methods in a new subclass of Field. For example, the fields.Datetime subclass of Field encodes Python datetime.datetime instances in a dictionary as timestamp strings.

classmethod get_by_url_id(url_id, **kwargs)
Returns the UserProfile instance with the given URL identifier.
homepage_url

The URL the related user has specified as an external website URL.

If the related user has not specified an external website URL, homepage_url will be None.

id
A URI that uniquely identifies the User associated with this UserProfile.
interests
A list of interests provided by the related user for display on their TypePad profile.
location
The related user’s location, as a free-form string provided by the user.
membership_management_page_url

The URL of a page where the user can manage their community memberships.

This URL is only present when the UserProfile is requested on behalf of the related user. That is, the membership_management_page_url is None unless the user is viewing their own profile.

preferred_username

The name the related user chose for use in their TypePad profile URL.

This name can be used as an ID to select this user in a transient URL. As this name can be changed, use the url_id field as a persistent key instead.

profile_edit_page_url

The URL of a page where the user can edit their profile information.

This URL is only present when the UserProfile is requested on behalf of the related user. That is, the profile_edit_page_url is None unless the user is viewing their own profile.

profile_page_url
The URL of the related user’s TypePad profile page.
url_id

An identifier for this UserProfile that can be used in URLs.

A user’s url_id is unique only across groups in one TypePad environment, so you should use id, not url_id, to associate data with a User (or UserProfile). When constructing URLs to API resources in one particular TypePad environment, however, use url_id.

user
Returns a User instance for the TypePad member whose UserProfile this is.
class typepad.api.Video(**kwargs)

An entry in a blog.

A field representing a nested DataObject.
A field representing a nested DataObject.

A link to a web video.

by_width(size)

Given a size, return a VideoLink of a video that is as wide as the requested size.

This mode scales the video such that the width is the size specified and the height is scaled to maintain the video’s aspect ratio.

embed_code
An opaque HTML fragment that, when embedded in an HTML page, will provide an inline player for the video.

A URL to the HTML permalink page of the video.

Use this field to specify the video when posting a new Video asset. When requesting an existing Video instance from the API, permalink_url will be None.

typepad.api.xid_from_atom_id(atom_id)

Returns the XID portion of the given Atom ID for a TypePad content object.

If the given Atom ID is not the same format as a TypePad content object’s Atom ID, returns None.

Previous topic

The TypePad Object

Next topic

TypePad Object Fields

This Page