Usage

Warning

Remember to import FixitPy, as the example code assume it is already imported.

import fixitpy

Getting Guides

Retrieving a guide from iFixit with FixitPy is simple, just call retrieve_guide with your specified guide ID.

guide = fixitpy.retrieve_guide(123)
# 123 is an example and can be changed

the returned guide is a dictionary object, and can be accessed similarly to the example below:

1# importing and guide retrieval hidden for simplicity, but still required
2
3print(f"Title: {guide.get("title")}")
4print(f"Difficulty: {guide.get("difficulty")}")
5print(f"Conclusion: {guide.get("conclusion")}")

As the returned guide is a dictionary, getting all values is as easy as printing them:

# importing and guide retrieval hidden for simplicity, but still required
print(guide)

Guide Steps

What makes a guide, a guide is the inclusion of steps to follow. These are included in the returned dictionary as a list under the key steps. Each step is a dictionary with the keys: text, title, and image_id

Hint

Every key in steps is a str, except image_id, which is a list.

Below is an example of iterating through each guide step:

1# importing and guide retrieval hidden for simplicity, but still required
2
3for step in guide.get("steps"):
4    print(step.get("title"))
5    print(step.get("text"))

Getting Media

Retrieving media from iFixit with FixitPy is simple, just call retrieve_media with your specified media ID.

media = fixitpy.retrieve_media(123)
# 123 is an example and can be changed

the returned media is a dictionary object, and can be accessed similarly to the example below:

1# importing and media retrieval hidden for simplicity, but still required
2
3print(media.get("width"))
4print(media.get("height"))

As the returned media is a dictionary, getting all values is as easy as printing them:

# importing and media retrieval hidden for simplicity, but still required
print(media)

Media Sizes

The media dictionary does not contain the images themselves, but the URLs as otherwise it be computationally expensive to retrieve all the images.

media contains a dictionary called sizes, which contains various urls to various image sizes

Warning

sizes is not rigid, and the available image sizes will vary, with some exceptions.

1# importing and media retrieval hidden for simplicity, but still required
2
3sizes = media.get("sizes")
4
5# 'thumbnail' is a very common size for iFixit Media
6print(sizes.get("thumbnail"))