Skip to content

pyravelry

Release Build status codecov Commit activity License

This is python wrapper for the Ravelry API (a database of knitting / crocheting patterns).

Use of this API wrapper requires a Ravelry Account and a username and apikey as specified in the HTTP Basic Auth section of the Ravelry API Documentation. Be sure to get read/write permissions if you want full access to all of the endpoints.

Quick Start:

$ pip install pyravelry
$ python -i
>>> from pyravelry import Client, Settings
>>> settings = Settings(RAVELRY_USERNAME=..., RAVELRY_API_KEY=...)
>>> client = Client(settings=settings)
>>> results = client.search.query(query="merino", limit=10, types=["Yarn"])
>>> results.results[0].title
'MerinoSeide'
>>> results.to_pandas().loc[:, ["title"]].head()
           title
0    MerinoSeide
1    Merinosukka
2      MERINO100
3  Merino-Tussah
4    Merinosilke
>>> results.to_polars()["title"].head()
shape: (10,)
Series: 'title' [str]
[
        "MerinoSeide"
        "Merinosukka"
        "MERINO100"
        "Merino-Tussah"
        "Merinosilke"
        "Merinowol"
        "Merinosweet"
        "Merino-Soft"
        "MerinoSilk"
        "MerinoCottonSilk"
]

More information about this API wrapper can be found in the pyravelry documentation.