Config
pyravelry.settings.RavelrySettings
¶
Bases: BaseSettings
Initializes the settings from which to call the Ravelry API.
Attributes:
| Name | Type | Description |
|---|---|---|
auth_tuple |
tuple[str, str]
|
formatted Revelry auth tuple for httpx. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ravelry_auth_username
|
str
|
|
required |
ravelry_auth_api_key
|
SecretStr
|
|
required |
base_url
|
HttpUrl
|
|
HttpUrl('https://api.ravelry.com/')
|
Source code in src/pyravelry/settings.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
pyravelry.settings.RavelrySettings.auth_tuple
property
¶
Returns credentials in the (username, password) format for httpx.
pyravelry.client.RavelryClient
¶
Client to get data from the revelry api.
Attributes:
| Name | Type | Description |
|---|---|---|
settings |
RavelrySettings
|
Authentication for the Ravelry API. |
_http |
SyncCacheClient
|
Httpx client with persistent caching |
color_families |
ColorFamiliesResource
|
Color Families endpoint |
fiber_categories |
FiberCategoriesResource
|
Fiber Categories endpoint |
yarn_weights |
YarnWeightsResource
|
Yarn Weights endpoint |
search |
SearchResource
|
Search endpoint |
fiber_attributes |
FiberAttributesResource
|
Fiber Attributes endpoint |
yarn_companies |
YarnCompaniesResource
|
Yarn Companies endpoint |
Source code in src/pyravelry/client.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
pyravelry.client.RavelryClient.__enter__()
¶
Method to enter context manager.
Source code in src/pyravelry/client.py
62 63 64 | |
pyravelry.client.RavelryClient.__exit__(exc_type, exc_val, exc_tb)
¶
Method to exit context manager, ensuring the client is closed.
Source code in src/pyravelry/client.py
66 67 68 69 70 71 72 73 | |
pyravelry.client.RavelryClient.__init__(settings)
¶
Instantiates a revelry httpx client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
RavelrySettings
|
Authentication and other settings. |
required |
Source code in src/pyravelry/client.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
pyravelry.client.RavelryClient.close()
¶
Closes the httpx client.
Source code in src/pyravelry/client.py
58 59 60 | |