usp.objects.page¶
Objects that represent a page found in one of the sitemaps.
- class usp.objects.page.SitemapPage¶
Single sitemap-derived page.
- __init__(url: str, priority: Decimal = Decimal('0.5'), last_modified: datetime | None = None, change_frequency: SitemapPageChangeFrequency | None = None, news_story: SitemapNewsStory | None = None, images: List[SitemapImage] | None = None)¶
Initialize a new sitemap-derived page.
- Parameters:
url – Page URL.
priority – Priority of this URL relative to other URLs on your site.
last_modified – Date of last modification of the URL.
change_frequency – Change frequency of a sitemap URL.
news_story – Google News story attached to the URL.
- to_dict()¶
Convert this page to a dictionary.
- property change_frequency: SitemapPageChangeFrequency | None¶
Get the change frequency of a sitemap URL.
- property images: List[SitemapImage] | None¶
Get the images attached to the URL.
- property news_story: SitemapNewsStory | None¶
Get the Google News story attached to the URL.
- class usp.objects.page.SitemapPageChangeFrequency¶
Change frequency of a sitemap URL.
- ALWAYS = 'always'¶
- DAILY = 'daily'¶
- HOURLY = 'hourly'¶
- MONTHLY = 'monthly'¶
- NEVER = 'never'¶
- WEEKLY = 'weekly'¶
- YEARLY = 'yearly'¶
- class usp.objects.page.SitemapNewsStory¶
Single story derived from Google News XML sitemap.
- __init__(title: str, publish_date: datetime, publication_name: str | None = None, publication_language: str | None = None, access: str | None = None, genres: List[str] = None, keywords: List[str] = None, stock_tickers: List[str] = None)¶
Initialize a new Google News story.
- Parameters:
title – Story title.
publish_date – Story publication date.
publication_name – Name of the news publication in which the article appears in.
publication_language – Primary language of the news publication in which the article appears in.
access – Accessibility of the article.
genres – List of properties characterizing the content of the article.
keywords – List of keywords describing the topic of the article.
stock_tickers – List of up to 5 stock tickers that are the main subject of the article.
- to_dict() dict¶
Convert to a dictionary representation.
- Returns:
the news story data as a dictionary
- property access: str | None¶
Get the accessibility of the article.
- Returns:
Accessibility of the article.
- property genres: List[str]¶
Get list of genres characterizing the content of the article.
Genres will be one “PressRelease”, “Satire”, “Blog”, “OpEd”, “Opinion”, “UserGenerated”
- property publication_language: str | None¶
Get the primary language of the news publication in which the article appears.
It should be an ISO 639 Language Code (either 2 or 3 letters).
- property publication_name: str | None¶
Get the name of the news publication in which the article appears.
- property stock_tickers: List[str]¶
Get stock tickers that are the main subject of the article.
Each ticker must be prefixed by the name of its stock exchange, and must match its entry in Google Finance. For example, “NASDAQ:AMAT” (but not “NASD:AMAT”), or “BOM:500325” (but not “BOM:RIL”).
Up to 5 tickers can be provided.
- class usp.objects.page.SitemapImage¶
Single image derived from Google Image XML sitemap.
All properties except
locare now deprecated in the XML specification, see https://developers.google.com/search/blog/2022/05/spring-cleaning-sitemap-extensionsThey will continue to be supported here.
- __init__(loc: str, caption: str | None = None, geo_location: str | None = None, title: str | None = None, license_: str | None = None)¶
Initialise a Google Image.
- Parameters:
loc – the URL of the image
caption – the caption of the image, optional
geo_location – the geographic location of the image, for example “Limerick, Ireland”, optional
title – the title of the image, optional
license – a URL to the license of the image, optional
- to_dict()¶
Convert to a dictionary representation.
- Returns:
the image data as a dictionary