usp.objects package¶
Submodules¶
usp.objects.page module¶
Objects that represent a page found in one of the sitemaps.
-
usp.objects.page.
SITEMAP_PAGE_DEFAULT_PRIORITY
= Decimal('0.5')¶ Default sitemap page priority, as per the spec.
-
class
usp.objects.page.
SitemapNewsStory
(title: str, publish_date: datetime.datetime, publication_name: Optional[str] = None, publication_language: Optional[str] = None, access: Optional[str] = None, genres: List[str] = None, keywords: List[str] = None, stock_tickers: List[str] = None)[source]¶ Bases:
object
Single story derived from Google News XML sitemap.
-
access
¶ Return accessibility of the article.
Returns: Accessibility of the article.
-
genres
¶ Return list of properties characterizing the content of the article.
Returns genres such as “PressRelease” or “UserGenerated”.
Returns: List of properties characterizing the content of the article
-
keywords
¶ Return list of keywords describing the topic of the article.
Returns: List of keywords describing the topic of the article.
-
publication_language
¶ Return primary language of the news publication in which the article appears in.
It should be an ISO 639 Language Code (either 2 or 3 letters).
Returns: Primary language of the news publication in which the article appears in.
-
publication_name
¶ Return name of the news publication in which the article appears in.
Returns: Name of the news publication in which the article appears in.
-
publish_date
¶ Return story publication date.
Returns: Story publication date.
-
stock_tickers
¶ Return list of up to 5 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”).
Returns: List of up to 5 stock tickers that are the main subject of the article.
-
title
¶ Return story title.
Returns: Story title.
-
-
class
usp.objects.page.
SitemapPage
(url: str, priority: decimal.Decimal = Decimal('0.5'), last_modified: Optional[datetime.datetime] = None, change_frequency: Optional[usp.objects.page.SitemapPageChangeFrequency] = None, news_story: Optional[usp.objects.page.SitemapNewsStory] = None)[source]¶ Bases:
object
Single sitemap-derived page.
-
change_frequency
¶ Return change frequency of a sitemap URL.
Returns: Change frequency of a sitemap URL.
-
last_modified
¶ Return date of last modification of the URL.
Returns: Date of last modification of the URL.
-
news_story
¶ Return Google News story attached to the URL.
Returns: Google News story attached to the URL.
-
priority
¶ Return priority of this URL relative to other URLs on your site.
Returns: Priority of this URL relative to other URLs on your site.
-
url
¶ Return page URL.
Returns: Page URL.
-
usp.objects.sitemap module¶
Objects that represent one of the found sitemaps.
-
class
usp.objects.sitemap.
AbstractIndexSitemap
(url: str, sub_sitemaps: List[usp.objects.sitemap.AbstractSitemap])[source]¶ Bases:
usp.objects.sitemap.AbstractSitemap
Abstract sitemap with URLs to other sitemaps.
-
all_pages
() → Iterator[usp.objects.page.SitemapPage][source]¶ Return iterator which yields all pages of this sitemap and linked sitemaps (if any).
Returns: Iterator which yields all pages of this sitemap and linked sitemaps (if any).
-
sub_sitemaps
¶ Return sub-sitemaps that are linked to from this sitemap.
Returns: Sub-sitemaps that are linked to from this sitemap.
-
-
class
usp.objects.sitemap.
AbstractPagesSitemap
(url: str, pages: List[usp.objects.page.SitemapPage])[source]¶ Bases:
usp.objects.sitemap.AbstractSitemap
Abstract sitemap that contains URLs to pages.
-
all_pages
() → Iterator[usp.objects.page.SitemapPage][source]¶ Return iterator which yields all pages of this sitemap and linked sitemaps (if any).
Returns: Iterator which yields all pages of this sitemap and linked sitemaps (if any).
-
pages
¶ Return list of pages found in a sitemap.
Returns: List of pages found in a sitemap.
-
-
class
usp.objects.sitemap.
AbstractSitemap
(url: str)[source]¶ Bases:
object
Abstract sitemap.
-
all_pages
() → Iterator[usp.objects.page.SitemapPage][source]¶ Return iterator which yields all pages of this sitemap and linked sitemaps (if any).
Returns: Iterator which yields all pages of this sitemap and linked sitemaps (if any).
-
url
¶ Return sitemap URL.
Returns: Sitemap URL.
-
-
class
usp.objects.sitemap.
IndexRobotsTxtSitemap
(url: str, sub_sitemaps: List[usp.objects.sitemap.AbstractSitemap])[source]¶ Bases:
usp.objects.sitemap.AbstractIndexSitemap
robots.txt sitemap with URLs to other sitemaps.
-
class
usp.objects.sitemap.
IndexWebsiteSitemap
(url: str, sub_sitemaps: List[usp.objects.sitemap.AbstractSitemap])[source]¶ Bases:
usp.objects.sitemap.AbstractIndexSitemap
Website’s root sitemaps, including robots.txt and extra ones.
-
class
usp.objects.sitemap.
IndexXMLSitemap
(url: str, sub_sitemaps: List[usp.objects.sitemap.AbstractSitemap])[source]¶ Bases:
usp.objects.sitemap.AbstractIndexSitemap
XML sitemap with URLs to other sitemaps.
-
class
usp.objects.sitemap.
InvalidSitemap
(url: str, reason: str)[source]¶ Bases:
usp.objects.sitemap.AbstractSitemap
Invalid sitemap, e.g. the one that can’t be parsed.
-
all_pages
() → Iterator[usp.objects.page.SitemapPage][source]¶ Return iterator which yields all pages of this sitemap and linked sitemaps (if any).
Returns: Iterator which yields all pages of this sitemap and linked sitemaps (if any).
-
reason
¶ Return reason why the sitemap is deemed invalid.
Returns: Reason why the sitemap is deemed invalid.
-
-
class
usp.objects.sitemap.
PagesAtomSitemap
(url: str, pages: List[usp.objects.page.SitemapPage])[source]¶ Bases:
usp.objects.sitemap.AbstractPagesSitemap
RSS 0.3 / 1.0 sitemap that contains URLs to pages.
-
class
usp.objects.sitemap.
PagesRSSSitemap
(url: str, pages: List[usp.objects.page.SitemapPage])[source]¶ Bases:
usp.objects.sitemap.AbstractPagesSitemap
RSS 2.0 sitemap that contains URLs to pages.
-
class
usp.objects.sitemap.
PagesTextSitemap
(url: str, pages: List[usp.objects.page.SitemapPage])[source]¶ Bases:
usp.objects.sitemap.AbstractPagesSitemap
Plain text sitemap that contains URLs to pages.
-
class
usp.objects.sitemap.
PagesXMLSitemap
(url: str, pages: List[usp.objects.page.SitemapPage])[source]¶ Bases:
usp.objects.sitemap.AbstractPagesSitemap
XML sitemap that contains URLs to pages.