Skip to content

Commit

Permalink
toloka-kit==0.1.23 release
Browse files Browse the repository at this point in the history
toloka-kit==0.1.23 release
  • Loading branch information
Losik authored Feb 1, 2022
2 parents 8f650e5 + b2eb915 commit 682c50d
Show file tree
Hide file tree
Showing 82 changed files with 1,782 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
0.1.23
-------------------
Python versions support:
* Python 3.10 support added
* Python 3.6 support dropped

Improvements:
* Added native support for verfied language skills
* Added native support for map provider's selection for pedestrian tasks in `AssignmentsIssuingViewConfig`
* Improved default status code dependent retry policies
* Requests originated from `toloka.streaming` or `toloka.metrics` are now marked with additional headers. This makes it easier for us to collect these features' usage statistics
* Annotations now use `urllib3` instead of weird `requests.packages.urllib3`
* Actualized outdated docstrings in `toloka.client.user_bonus`


0.1.22
-------------------
Fixes:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Main advantages of Toloka:

Requirements
--------------
- Python 3.6+
- Python 3.7+
- Register in [Toloka.ai](https://toloka.ai/?utm_source=github&utm_medium=site&utm_campaign=tolokakit) as requester. Registration process described [here.](https://toloka.ai/docs/guide/concepts/access.html?utm_source=github&utm_medium=site&utm_campaign=tolokakit)
- [Topping up your account.](https://toloka.ai/docs/guide/concepts/refill.html?utm_source=github&utm_medium=site&utm_campaign=tolokakit)
- Getting an OAuth. Learn more in [help](https://toloka.ai/docs/api/concepts/access.html?utm_source=github&utm_medium=site&utm_campaign=tolokakit) and in the image below.
Expand Down
5 changes: 3 additions & 2 deletions docs/reference/_reference.ditamap
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
<topicref format="markdown" href="toloka.client.project.Project.add_requester_translation.md" navtitle="Project.add_requester_translation" locktitle="yes" toc="no"/>
<topicref format="markdown" href="toloka.client.project.Project.AssignmentsIssuingType.md" navtitle="Project.AssignmentsIssuingType" locktitle="yes" toc="no"/>
<topicref format="markdown" href="toloka.client.project.Project.AssignmentsIssuingViewConfig.md" navtitle="Project.AssignmentsIssuingViewConfig" locktitle="yes" toc="no"/>
<topicref format="markdown" href="toloka.client.project.Project.AssignmentsIssuingViewConfig.MapProvider.md" navtitle="Project.AssignmentsIssuingViewConfig.MapProvider" locktitle="yes" toc="no"/>
<topicref format="markdown" href="toloka.client.project.Project.ProjectStatus.md" navtitle="Project.ProjectStatus" locktitle="yes" toc="no"/>
<topicref format="markdown" href="toloka.client.project.Project.set_default_language.md" navtitle="Project.set_default_language" locktitle="yes" toc="no"/>
<topichead navtitle="localization">
Expand Down Expand Up @@ -999,7 +1000,7 @@
<topicref format="markdown" href="toloka.streaming.observer.PoolStatusObserver.register_callback.md" toc="no"/>
</topichead>
<topichead navtitle="pipeline">
<topicref format="markdown" href="toloka.streaming.pipeline.Pipeline.inject.md", navtitle="Pipeline.inject", toc="no"/>
<topicref format="markdown" href="toloka.streaming.pipeline.Pipeline.inject.md" navtitle="Pipeline.inject" toc="no"/>
<topicref format="markdown" href="toloka.streaming.pipeline.Pipeline.md"/>
<topicref format="markdown" href="toloka.streaming.pipeline.Pipeline.register.md" toc="no"/>
<topicref format="markdown" href="toloka.streaming.pipeline.Pipeline.run.md" toc="no"/>
Expand All @@ -1023,13 +1024,13 @@
</topichead>
<topichead navtitle="toloka.util" toc="no">
<topicref format="markdown" href="toloka.util._managing_headers.add_headers.md" navtitle="add_headers" toc="no"/>
<topicref format="markdown" href="toloka.util._managing_headers.async_add_headers.md" navtitle="add_headers" toc="no"/>
<topicref format="markdown" href="toloka.util._codegen.attribute.md" toc="no"/>
<topicref format="markdown" href="toloka.util._codegen.fix_attrs_converters.md" toc="no"/>
<topicref format="markdown" href="toloka.util._docstrings.inherit_docstrings.md" toc="no"/>
<topicref format="markdown" href="toloka.util._extendable_enum.extend_enum.md" toc="no"/>
<topicref format="markdown" href="toloka.util._extendable_enum.ExtendableStrEnum.md" toc="no"/>
<topicref format="markdown" href="toloka.util._extendable_enum.ExtendableStrEnumMetaclass.md" toc="no"/>
<topicref format="markdown" href="toloka.util._managing_headers.add_headers.md" toc="no"/>
<topicref format="markdown" href="toloka.util.async_utils.AsyncInterfaceWrapper.md"/>
<topicref format="markdown" href="toloka.util.async_utils.AsyncMultithreadWrapper.md"/>
<topicref format="markdown" href="toloka.util.async_utils.Cooldown.md"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AsyncTolokaClient(
)
```

Class that implements interaction with [Toloka API], in an asynchronous way.
Class that implements interaction with [Toloka API](https://toloka.ai/docs/api/concepts/about.html), in an asynchronous way.


All methods are wrapped as async. So all methods calls must be awaited.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
add_message_thread_to_folders(
self,
message_thread_id: str,
folders: Union[List[Union[str, Folder]], MessageThreadFolders]
folders: Union[List[Union[Folder, str]], MessageThreadFolders]
)
```

Expand All @@ -16,7 +16,7 @@ Adds a message chain to one or more folders ("unread", "important" etc.)
| Parameters | Type | Description |
| :----------| :----| :-----------|
`message_thread_id`|**str**|<p>ID of message chain.</p>
`folders`|**Union\[List\[Union\[str, [Folder](toloka.client.message_thread.Folder.md)\]\], [MessageThreadFolders](toloka.client.message_thread.MessageThreadFolders.md)\]**|<p>List of folders, where to move chain.</p>
`folders`|**Union\[List\[Union\[[Folder](toloka.client.message_thread.Folder.md), str\]\], [MessageThreadFolders](toloka.client.message_thread.MessageThreadFolders.md)\]**|<p>List of folders, where to move chain.</p>

* **Returns:**

Expand Down
10 changes: 8 additions & 2 deletions docs/reference/toloka.client.TolokaClient.create_user_bonus.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ new_bonus = toloka_client.create_user_bonus(
UserBonus(
user_id='1',
amount=decimal.Decimal('0.50'),
public_title='Perfect job!',
public_message='You are the best performer!',
public_title={
'EN': 'Perfect job!',
'RU': 'Прекрасная работа!',
},
public_message={
'EN': 'You are the best performer!',
'RU': 'Молодец!',
},
assignment_id='012345'
)
)
Expand Down
20 changes: 16 additions & 4 deletions docs/reference/toloka.client.TolokaClient.create_user_bonuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,26 @@ new_bonuses=[
UserBonus(
user_id='1',
amount=decimal.Decimal('0.50'),
public_title='Perfect job!',
public_message='You are the best performer!',
public_title={
'EN': 'Perfect job!',
'RU': 'Прекрасная работа!',
},
public_message={
'EN': 'You are the best performer!',
'RU': 'Молодец!',
},
assignment_id='1'),
UserBonus(
user_id='2',
amount=decimal.Decimal('1.0'),
public_title='Excellent work!',
public_message='You completed all the tasks!',
public_title={
'EN': 'Excellent work!',
'RU': 'Отличная работа!',
},
public_message={
'EN': 'You have completed all tasks!',
'RU': 'Сделаны все задания!',
},
assignment_id='2')
]
toloka_client.create_user_bonuses(new_bonuses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,26 @@ new_bonuses=[
UserBonus(
user_id='1',
amount=decimal.Decimal('0.50'),
public_title='Perfect job!',
public_message='You are the best performer!',
public_title={
'EN': 'Perfect job!',
'RU': 'Прекрасная работа!',
},
public_message={
'EN': 'You are the best performer!',
'RU': 'Молодец!',
},
assignment_id='1'),
UserBonus(
user_id='2',
amount=decimal.Decimal('1.0'),
public_title='Excellent work!',
public_message='You completed all the tasks!',
public_title={
'EN': 'Excellent work!',
'RU': 'Превосходная работа!',
},
public_message={
'EN': 'You have completed all tasks!',
'RU': 'Сделаны все задания!',
},
assignment_id='2')
]
create_bonuses = toloka_client.create_user_bonuses_async(new_bonuses)
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/toloka.client.TolokaClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ TolokaClient(
token: str,
environment: Union[Environment, str, None] = None,
retries: Union[int, Retry] = 3,
timeout: Union[float, Tuple[float, float]] = ...,
timeout: Union[float, Tuple[float, float]] = 10.0,
url: Optional[str] = None,
retry_quotas: Union[List[str], str, None] = 'MIN',
retryer_factory: Optional[Callable[[], Retry]] = None
)
```

Class that implements interaction with [Toloka API](https://yandex.com/dev/toloka/doc/concepts/about.html).
Class that implements interaction with [Toloka API](https://toloka.ai/docs/api/concepts/about.html).


Objects of other classes are created and modified only in memory of your computer.
Expand All @@ -30,7 +30,7 @@ Call `TolokaClient.update_project` and pass the `Project` to apply your changes.

| Parameters | Type | Description |
| :----------| :----| :-----------|
`token`|**str**|<p>Your OAuth token for Toloka. You can learn more about how to get it [here](https://yandex.com/dev/toloka/doc/concepts/access.html#access__token)</p>
`token`|**str**|<p>Your OAuth token for Toloka. You can learn more about how to get it [here](https://toloka.ai/docs/api/concepts/access.html#access__token)</p>
`environment`|**Union\[[Environment](toloka.client.TolokaClient.Environment.md), str, None\]**|<p>There are two environments in Toloka:<ul><li>`SANDBOX`[Testing environment](https://sandbox.toloka.yandex.com) for Toloka requesters. You can test complex projects before starting them on real performers. Nobody will see your tasks, and it&#x27;s free.</li><li>`PRODUCTION`[Production environment](https://toloka.yandex.com) for Toloka requesters. You spend money there and get the results. You need to register in each environment separately. OAuth tokens are generated in each environment separately too. </li></ul></p><p>Default value: `None`.</p>
`retries`|**Union\[int, Retry\]**|<p>Retry policy for failed API requests. Possible values:<ul><li>`int` – The number of retries for all requests. In this case, the retry policy is created automatically.</li><li>`Retry` object – Deprecated type. Use `retryer_factory` parameter instead. </li></ul></p><p>Default value: `3`.</p>
`timeout`|**Union\[float, Tuple\[float, float\]\]**|<p>Number of seconds that [Requests library](https://docs.python-requests.org/en/master) will wait for your client to establish connection to a remote machine. Possible values:<ul><li>`float` – Single value for both connect and read timeouts.</li><li>`Tuple[float, float]` – Tuple sets the values for connect and read timeouts separately.</li><li>`None` – Set the timeout to `None` only if you are willing to wait the [Response](https://docs.python-requests.org/en/master/api/#requests.Response) for unlimited number of seconds. </li></ul></p><p>Default value: `10.0`.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
remove_message_thread_from_folders(
self,
message_thread_id: str,
folders: Union[List[Union[str, Folder]], MessageThreadFolders]
folders: Union[List[Union[Folder, str]], MessageThreadFolders]
)
```

Expand All @@ -16,7 +16,7 @@ Deletes a message chain from one or more folders ("unread", "important" etc.)
| Parameters | Type | Description |
| :----------| :----| :-----------|
`message_thread_id`|**str**|<p>ID of message chain.</p>
`folders`|**Union\[List\[Union\[str, [Folder](toloka.client.message_thread.Folder.md)\]\], [MessageThreadFolders](toloka.client.message_thread.MessageThreadFolders.md)\]**|<p> List of folders, where from to remove chain.</p>
`folders`|**Union\[List\[Union\[[Folder](toloka.client.message_thread.Folder.md), str\]\], [MessageThreadFolders](toloka.client.message_thread.MessageThreadFolders.md)\]**|<p> List of folders, where from to remove chain.</p>

* **Returns:**

Expand Down
4 changes: 3 additions & 1 deletion docs/reference/toloka.client.filter.Languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Languages(
self,
operator: InclusionOperator,
value: Union[str, List[str]]
value: Union[str, List[str]],
verified: bool = False
)
```

Expand All @@ -17,3 +18,4 @@ Use to select users by languages specified by the user in the profile.
| :----------| :----| :-----------|
`operator`|**[InclusionOperator](toloka.client.primitives.operators.InclusionOperator.md)**|<p>Comparison operator in the condition. For example, for a condition &quot;The user must be 18 years old or older» used date of birth and operator GTE («Greater than or equal»). Possible key values operator depends on the data type in the field value</p>
`value`|**Union\[str, List\[str\]\]**|<p>Languages specified by the user in the profile (two-letter ISO code of the standard ISO 639-1 in upper case).</p>
`verified`|**-**|<p>If set to True only users who have passed language test will be selected. Currently only following ISO codes are supported: DE, EN, FR, JA, PT, SV, RU, AR, ES.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# MapProvider
`toloka.client.project.Project.AssignmentsIssuingViewConfig.MapProvider`

Map provider for assignments_issuing_view_config:

## Attributes Description

| Name | Value | Description |
| :------| :-----------| :----------|
`YANDEX`|'YANDEX'|<p>Use Yandex.Maps as a map provider</p>
`GOOGLE`|'GOOGLE'|<p>Use Google Maps as a map provider</p>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ AssignmentsIssuingViewConfig(
self,
*,
title_template: Optional[str] = None,
description_template: Optional[str] = None
description_template: Optional[str] = None,
map_provider: Optional[MapProvider] = None
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SelectFieldV1(
self,
data: Optional[BaseComponent] = None,
options: Optional[Union[BaseComponent, Option]] = None,
options: Optional[Union[BaseComponent, List[Union[BaseComponent, Option]]]] = None,
*,
placeholder: Optional[Any] = None,
hint: Optional[Any] = None,
Expand All @@ -30,7 +30,7 @@ To allow selecting multiple options, use the field.checkbox-group component.
| Parameters | Type | Description |
| :----------| :----| :-----------|
`data`|**Optional\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md)\]**|<p>Data with values that will be processed or changed.</p>
`options`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), [Option](toloka.client.project.template_builder.fields.SelectFieldV1.Option.md)\]\]**|<p>Options to choose from.</p>
`options`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), List\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), [Option](toloka.client.project.template_builder.fields.SelectFieldV1.Option.md)\]\]\]\]**|<p>Options to choose from.</p>
`placeholder`|**Optional\[Any\]**|<p>The text that will be displayed if none of the options is selected.</p>
`hint`|**Optional\[Any\]**|<p>Hint text.</p>
`label`|**Optional\[Any\]**|<p>Label above the component.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ReplaceHelperV1(
Allows you to replace some parts of the string with others.


This helper function returns a string in which all occurrences of 'findindataare replaced withreplace`.
This helper function returns a string in which all occurrences of `find` in `data` are replaced with `replace`.
Because the helper.replace helper returns a string, it can be used in properties that accept string values.

## Parameters Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ You can use this component to download files from Yandex.Disk.


To use YandexDiskProxyHelper, connect Yandex.Disk to your Toloka account and add the proxy by following
the [instructions](https://yandex.com/support/toloka-requester/concepts/prepare-data.html?lang=en)
the [instructions](https://toloka.ai/docs/guide/concepts/prepare-data.html?lang=en)
Select the component that you want to add, such as view.image for an image or view.audio for an audio file.
In the url property of this component, use YandexDiskProxyHelper.

## Parameters Description

| Parameters | Type | Description |
| :----------| :----| :-----------|
`path`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), str\]\]**|<p>Path to the file in the /&amp;lt;Proxy name&amp;gt;/&amp;lt;File name&amp;gt;.&amp;lt;type&amp;gt; format</p>
`path`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), str\]\]**|<p>Path to the file in the &lt;Proxy name&gt;/&lt;File name&gt;.&lt;type&gt; format</p>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ VideoViewV1(
full_height: Optional[Union[BaseComponent, bool]] = None,
max_width: Optional[Union[BaseComponent, float]] = None,
min_width: Optional[Union[BaseComponent, float]] = None,
ratio: Optional[Union[BaseComponent, List[Union[BaseComponent, float]]]] = None,
hint: Optional[Any] = None,
label: Optional[Any] = None,
validation: Optional[BaseComponent] = None,
Expand All @@ -33,7 +34,7 @@ cropped.
`full_height`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), bool\]\]**|<p>If true, the element takes up all the vertical free space. The element is set to a minimum height of 400 pixels.</p>
`max_width`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), float\]\]**|<p>Maximum width of the element in pixels, must be greater than min_width.</p>
`min_width`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), float\]\]**|<p>Minimum width of the element in pixels. Takes priority over max_width.</p>
`ratio`|**Optional\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), List\[Union\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md), float\]\]\]\]**|<p>The aspect ratio of the video block. An array of two numbers: the first sets the width of the block and the second sets the height.</p>
`hint`|**Optional\[Any\]**|<p>Hint text.</p>
`label`|**Optional\[Any\]**|<p>Label above the component.</p>
`validation`|**Optional\[[BaseComponent](toloka.client.project.template_builder.base.BaseComponent.md)\]**|<p>Validation based on condition.</p>
`ratio`|**-**|<p>The aspect ratio of the video block. An array of two numbers: the first sets the width of the block and the second sets the height.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ClassicViewSpec(
A classic view specification defined with HTML, CSS and JS.


For more information, see [Toloka Requester's guide](https://yandex.ru/support/toloka-requester/?lang=en)
For more information, see [Toloka Requester's guide](https://toloka.ai/ru/docs/guide/?lang=en)

## Parameters Description

Expand Down
Loading

0 comments on commit 682c50d

Please sign in to comment.