pyfixit Package

pyfixit Package

base Module

class pyfixit.base.Base[source]

Bases: object

Base object defining common behavior for all API objects.

Objects inheriting from this class should implement a refresh() method that fetches any data it has been waiting to lazily-load.

category Module

class pyfixit.category.Category(name)[source]

Bases: pyfixit.base.Base

A category of guides, answers, wiki pages, etc. Often takes the form of a device.

Variables:
  • name (string) – The identifying name of the category. Ex: Powerbook G3 Wallstreet.
  • ancestors (iterable) – (Lazy) An ordered list of pyfixit.category.Category objects. The first is this category’s parent, followed by its grandparent, up until the root category.
  • contents (WikiText) – (Lazy) A pyfixit.wikitext.WikiText of the text describing this category.
  • guides (iterable) – (Lazy) An iterable of the pyfixit.guide.Guide objects under this category.
  • description (string) – (Lazy) A short description of the category.
  • flags (iterable) – (Lazy) A list of pyfixit.flag.Flag objects, each containing an informational note about the category.
  • image (Image) – (Lazy) The primary pyfixit.image.Image associated with the category.
  • locale (string) – (Lazy) The locale of the text throughout the category.
  • title (string) – (Lazy) The display title (which is alterable, unlike the identifying name).
refresh()[source]

Refetch instance data from the API.

constants Module

Various constants for use throughout the project.

flag Module

class pyfixit.flag.Flag(title, text)[source]

Bases: object

A way of identifying a common bit of information about a guide or wiki.

You almost certainly want to use from_id() instead of this constructor.

Variables:
  • title (string) – The title of the flag. Ex: Grammar Police.
  • text (string) – The text describing the flag. Ex: Embrace your inner English teacher and help improve this guide's grammar!.
static from_id(id)[source]

Fetch a pre-created singleton flag.

Variables:id (string) – The flag’s id, as seen on http://www.ifixit.com/Info/Flags.

guide Module

class pyfixit.guide.Guide(guideid)[source]

Bases: pyfixit.base.Base

A series of instructions for performing a task.

Variables:
  • id (int) – The identifying id for the guide. Ex: 5.
  • category (Category) – (Lazy) The pyfixit.category.Category to which this guide belongs.
  • url (string) – (Lazy) The canonical URL for viewing this guide.
  • title (string) – (Lazy) The display title of the guide.
  • image (Image) – (Lazy) The primary pyfixit.image.Image associated with the guide.
  • locale (string) – (Lazy) The locale of the text displayed through the guide.
  • introduction (WikiText) – (Lazy) A pyfixit.wikitext.WikiText of the introductory text on the guide.
  • conclusion (WikiText) – (Lazy) A pyfixit.wikitext.WikiText of the concluding text on the guide.
  • subject (string) – (Lazy) The thing the guide’s user is operating on. Ex: Processor.
  • modifiedDate (datetime) – (Lazy) When the guide was last modified (UTC).
  • createdDate (datetime) – (Lazy) When the guide was created (UTC).
  • publishedDate (datetime) – (Lazy) When the guide was first made publicly-viewable (UTC).
  • steps (iterable) – (Lazy) An ordered list of pyfixit.step.Step objects representing the steps to follow.
  • type (string) – (Lazy) The sort of guide. Ex: installation.
  • public (boolean) – (Lazy) Whether everyone can view the guide. If a guide is not public, only the author and administrative users can view it.
  • revision (int) – (Lazy) The revisionid associated with this version of the step in the database, suitable for determining equality of objects not modified after being pulled from the API. Ex: 42928.
  • difficulty (string) – (Lazy) An estimate of the difficulty of the guide. Choices: Very easy, Easy, Moderate, Difficult, Very difficult.
  • prerequisites (iterable) – (Lazy) A collection of guides that must be completed prior to starting this guide.
  • flags (iterable) – (Lazy) A list of pyfixit.flag.Flag objects, each containing an informational note about the guide.
static all(guideids=None, filter=None, order=None)[source]

Fetch all guides.

Parameters:
  • guideids (iterable) – Only return Guides corresponding to these ids.
  • filter (string) – Only return guides of this type. Choices: installation, repair, disassembly, teardown, technique, maintenance.
  • order (string) – Instead of ordering by guideid, order alphabetically. Choices: ASC, DESC.
Return type:

generator of pyfixit.guide.Guide objects.

refresh()[source]

Refetch instance data from the API.

image Module

class pyfixit.image.Image(id)[source]

Bases: pyfixit.base.Base

An image that has been uploaded to the site.

Variables:
  • id (int) – The id of this image. Ex: 26674.
  • height (int) – (Lazy) Height in pixels. Ex: 1200.
  • width (int) – (Lazy) Width in pixels. Ex: 1600.
  • original (string) – (Lazy, Optional) URL to the originally-uploaded image.
  • mini (string) – (Lazy, Optional) URL to the mini size of the image.
  • thumbnail (string) – (Lazy, Optional) URL to the thumbnail size of the image.
  • standard (string) – (Lazy, Optional) URL to the standard size of the image.
  • medium (string) – (Lazy, Optional) URL to the medium size of the image.
  • large (string) – (Lazy, Optional) URL to the large size of the image.
  • huge (string) – (Lazy, Optional) URL to the huge size of the image.
refresh()[source]

Refetch instance data from the API.

line Module

class pyfixit.line.Line(guideid, stepid, lineid, data=None)[source]

Bases: pyfixit.base.Base

One line of text in a step.

Variables:
  • guideid (int) – The id of the pyfixit.guide.Guide owning this step. Ex: 5.
  • stepid (int) – The id of the pyfixit.step.Step owning this step. Ex: 14.
  • lineid (int) – This line’s id. Ex: 23.
  • bullet (string) – The color or type of the step’s bullet. Ex: black.
  • level (int) – The number of levels in this step is indented. Ex: 0.
  • text (string) – A pyfixit.wikitext.WikiText of the step’s text.
refresh()[source]

Refetch instance data from the API.

step Module

class pyfixit.step.Step(guideid, stepid, data=None)[source]

Bases: pyfixit.base.Base

One step in a guide.

Variables:
  • guideid (int) – The id of the pyfixit.guide.Guide owning this step. Ex: 5.
  • stepid (int) – This step’s id. Ex: 14.
  • orderby (int) – This step’s location in its guide relative to the other steps. Lower numbers come first. Counting starts at 0 and should not duplicate or skip over any natural numbers. Ex: 0.
  • revision (int) – The revisionid associated with this version of the step in the database, suitable for determining equality of objects not modified after being pulled from the API. Ex: 33880.
  • title (string) – The title of this step. May be an empty string.
  • lines (iterable) – An iterable of the pyfixit.line.Line objects composing this step.
  • media (iterable) – (Optional) A list of pyfixit.image.Image objects illustrating the step.
refresh()[source]

Refetch instance data from the API.

wikitext Module

class pyfixit.wikitext.WikiText(raw, rendered)[source]

Bases: object

A bit of marked-up text.

Variables:
  • raw (string) – The text including markup. Ex: '''bold'''.
  • rendered (string) – The rendered text. Ex: <strong>bold</strong>.