moderation_api 2.1.1__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {moderation_api-2.1.1/src/moderation_api.egg-info → moderation_api-2.3.0}/PKG-INFO +50 -35
- {moderation_api-2.1.1 → moderation_api-2.3.0}/README-PYPI.md +49 -34
- {moderation_api-2.1.1 → moderation_api-2.3.0}/README.md +49 -34
- {moderation_api-2.1.1 → moderation_api-2.3.0}/pyproject.toml +1 -1
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/_version.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/account.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/actions.py +24 -12
- moderation_api-2.1.1/src/moderation_api/authors.py → moderation_api-2.3.0/src/moderation_api/analytics.py +458 -386
- moderation_api-2.1.1/src/moderation_api/content_sdk.py → moderation_api-2.3.0/src/moderation_api/apikeys.py +54 -132
- moderation_api-2.3.0/src/moderation_api/authors.py +2145 -0
- moderation_api-2.3.0/src/moderation_api/content_sdk.py +845 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/badrequesterror.py +2 -1
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/notfounderror.py +1 -0
- moderation_api-2.3.0/src/moderation_api/feedback.py +253 -0
- moderation_api-2.3.0/src/moderation_api/items.py +1135 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/__init__.py +523 -132
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/addwordlistwordsop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/allowcontentop.py +120 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/badrequesterror.py +3 -1
- moderation_api-2.3.0/src/moderation_api/models/blockauthorop.py +97 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/createactionop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/createauthorop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/createfeedbackop.py +137 -0
- moderation_api-2.3.0/src/moderation_api/models/createprojectapikeyop.py +52 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/createwebhookop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/createwordlistop.py +146 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/deleteactionop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/deleteauthorop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/deletewebhookop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/executeactionop.py +23 -3
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getaccountop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getactionop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/getanalyticsauthorsop.py +162 -0
- moderation_api-2.3.0/src/moderation_api/models/getanalyticsautomationop.py +188 -0
- moderation_api-2.3.0/src/moderation_api/models/getanalyticschannelsop.py +123 -0
- moderation_api-2.3.0/src/moderation_api/models/getanalyticspoliciesop.py +148 -0
- moderation_api-2.3.0/src/moderation_api/models/getanalyticssummaryop.py +280 -0
- moderation_api-2.3.0/src/moderation_api/models/getanalyticsvolumesop.py +167 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getauthorop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/getqueueop.py +59 -0
- moderation_api-2.3.0/src/moderation_api/models/getqueuestatsop.py +176 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getwebhookop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getwebhooksecretop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getwordlistembeddingstatusop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getwordlistop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listactionsop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listauthorsop.py +5 -14
- moderation_api-2.3.0/src/moderation_api/models/listqueueitemsop.py +174 -0
- moderation_api-2.3.0/src/moderation_api/models/listqueuesop.py +86 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listwebhooksop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listwordlistsop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/notfounderror.py +2 -0
- moderation_api-2.3.0/src/moderation_api/models/projectapikey.py +42 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/publicauthor.py +3 -3
- moderation_api-2.3.0/src/moderation_api/models/queue.py +52 -0
- moderation_api-2.3.0/src/moderation_api/models/queueitem.py +644 -0
- moderation_api-2.3.0/src/moderation_api/models/queuewithcounts.py +67 -0
- moderation_api-2.3.0/src/moderation_api/models/rejectcontentop.py +120 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/removewordlistwordsop.py +2 -2
- moderation_api-2.3.0/src/moderation_api/models/resolvequeueitemop.py +78 -0
- moderation_api-2.3.0/src/moderation_api/models/resolvequeueitemsop.py +96 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/submitcontentop.py +23 -23
- moderation_api-2.1.1/src/moderation_api/models/unresolvequeueitemop.py → moderation_api-2.3.0/src/moderation_api/models/suspendauthorop.py +26 -44
- moderation_api-2.3.0/src/moderation_api/models/unblockauthorop.py +97 -0
- moderation_api-2.3.0/src/moderation_api/models/unresolvequeueitemop.py +93 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updateactionop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updateauthorop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updatewebhookop.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updatewordlistop.py +4 -4
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/projects.py +14 -0
- moderation_api-2.1.1/src/moderation_api/items.py → moderation_api-2.3.0/src/moderation_api/queue_sdk.py +104 -204
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/sdk.py +8 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/webhooks.py +10 -10
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/webhooksecret.py +2 -2
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/wordlist.py +254 -12
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/words.py +4 -4
- {moderation_api-2.1.1 → moderation_api-2.3.0/src/moderation_api.egg-info}/PKG-INFO +50 -35
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api.egg-info/SOURCES.txt +23 -0
- moderation_api-2.1.1/src/moderation_api/models/getqueueop.py +0 -430
- moderation_api-2.1.1/src/moderation_api/models/getqueuestatsop.py +0 -278
- moderation_api-2.1.1/src/moderation_api/models/listqueueitemsop.py +0 -350
- moderation_api-2.1.1/src/moderation_api/models/resolvequeueitemop.py +0 -136
- moderation_api-2.1.1/src/moderation_api/queue_sdk.py +0 -511
- {moderation_api-2.1.1 → moderation_api-2.3.0}/LICENSE +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/setup.cfg +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/__init__.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/_hooks/__init__.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/_hooks/sdkhooks.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/_hooks/types.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/basesdk.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/channels.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/__init__.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/authenticationerror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/conflicterror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/internalservererror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/moderationapidefaulterror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/moderationapierror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/no_response_error.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/permissiondeniederror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/ratelimiterror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/errors/responsevalidationerror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/httpclient.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/authenticationerror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/channel.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/conflicterror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/createchannelop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/createprojectop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/deletechannelop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/deleteprojectop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/duplicatechannelop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/duplicateprojectop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/errorissue.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getchannelop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/getprojectop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/internalservererror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listchannelsop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/listprojectsop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/pagination.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/permissiondeniederror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/project.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/projectwithkey.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/ratelimiterror.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/security.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updatechannelop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/models/updateprojectop.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/py.typed +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/sdkconfiguration.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/types/__init__.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/types/base64fileinput.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/types/basemodel.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/__init__.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/annotations.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/datetimes.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/dynamic_imports.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/enums.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/eventstreaming.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/forms.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/headers.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/logger.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/metadata.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/queryparams.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/requestbodies.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/retries.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/security.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/serializers.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/unions.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/unmarshal_json_response.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/url.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/utils/values.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api/webhook_signature.py +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api.egg-info/dependency_links.txt +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api.egg-info/requires.txt +0 -0
- {moderation_api-2.1.1 → moderation_api-2.3.0}/src/moderation_api.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: moderation_api
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: The official Python library for the Moderation API
|
|
5
5
|
Author: Moderation API
|
|
6
6
|
License: Apache-2.0
|
|
@@ -310,12 +310,10 @@ with ModerationAPI(
|
|
|
310
310
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
311
311
|
) as ma_client:
|
|
312
312
|
|
|
313
|
-
res = ma_client.
|
|
313
|
+
res = ma_client.analytics.summary(range="30d")
|
|
314
314
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
res = res.next()
|
|
315
|
+
# Handle response
|
|
316
|
+
print(res)
|
|
319
317
|
|
|
320
318
|
```
|
|
321
319
|
<!-- End Authentication [security] -->
|
|
@@ -325,9 +323,9 @@ with ModerationAPI(
|
|
|
325
323
|
Moderation API has two kinds of API keys:
|
|
326
324
|
|
|
327
325
|
- A **project key** works with one project: content, authors, review queues, actions, wordlists, webhooks and the account. Most integrations need only this key.
|
|
328
|
-
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels.
|
|
326
|
+
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels. It can also use any project's endpoints: name the project with `projectId`.
|
|
329
327
|
|
|
330
|
-
|
|
328
|
+
A project key can't call the management API: the API returns `403` with the code `organization_key_required`. If you use both kinds of key, create one client for each:
|
|
331
329
|
|
|
332
330
|
```python
|
|
333
331
|
import os
|
|
@@ -369,6 +367,15 @@ Create the organization client only where you manage projects and channels, for
|
|
|
369
367
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/actions/README.md#delete) - Delete an action
|
|
370
368
|
* [execute](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/actions/README.md#execute) - Execute moderation action
|
|
371
369
|
|
|
370
|
+
### [Analytics](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md)
|
|
371
|
+
|
|
372
|
+
* [summary](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#summary) - Get the analytics summary
|
|
373
|
+
* [policies](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#policies) - Get the most flagged policies
|
|
374
|
+
* [authors](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#authors) - Get the most flagged authors
|
|
375
|
+
* [channels](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#channels) - Get analytics per channel
|
|
376
|
+
* [volumes](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#volumes) - Get volumes over time
|
|
377
|
+
* [automation](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#automation) - Get the automation breakdown
|
|
378
|
+
|
|
372
379
|
### [Authors](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md)
|
|
373
380
|
|
|
374
381
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#list) - List authors
|
|
@@ -376,6 +383,9 @@ Create the organization client only where you manage projects and channels, for
|
|
|
376
383
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#retrieve) - Get author details
|
|
377
384
|
* [update](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#update) - Update author details
|
|
378
385
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#delete) - Delete an author
|
|
386
|
+
* [block](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#block) - Block author
|
|
387
|
+
* [suspend](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#suspend) - Suspend author
|
|
388
|
+
* [unblock](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#unblock) - Unblock author
|
|
379
389
|
|
|
380
390
|
### [Channels](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/channels/README.md)
|
|
381
391
|
|
|
@@ -388,8 +398,14 @@ Create the organization client only where you manage projects and channels, for
|
|
|
388
398
|
|
|
389
399
|
### [Content](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md)
|
|
390
400
|
|
|
401
|
+
* [reject](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#reject) - Reject content
|
|
402
|
+
* [allow](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#allow) - Allow content
|
|
391
403
|
* [submit](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#submit) - Submit content
|
|
392
404
|
|
|
405
|
+
### [Feedback](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/feedback/README.md)
|
|
406
|
+
|
|
407
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/feedback/README.md#create) - Send feedback
|
|
408
|
+
|
|
393
409
|
### [Projects](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md)
|
|
394
410
|
|
|
395
411
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#list) - List projects
|
|
@@ -399,15 +415,21 @@ Create the organization client only where you manage projects and channels, for
|
|
|
399
415
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#delete) - Delete a project
|
|
400
416
|
* [duplicate](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#duplicate) - Duplicate a project
|
|
401
417
|
|
|
418
|
+
#### [Projects.ApiKeys](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/apikeys/README.md)
|
|
419
|
+
|
|
420
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/apikeys/README.md#create) - Create a project API key
|
|
421
|
+
|
|
402
422
|
### [Queue](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md)
|
|
403
423
|
|
|
424
|
+
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#list) - List queues
|
|
404
425
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#retrieve) - Get a queue
|
|
405
426
|
* [get_stats](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#get_stats) - Get queue statistics
|
|
406
427
|
|
|
407
428
|
#### [Queue.Items](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md)
|
|
408
429
|
|
|
409
|
-
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#list) -
|
|
430
|
+
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#list) - List queue items
|
|
410
431
|
* [resolve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#resolve) - Resolve a queue item
|
|
432
|
+
* [resolve_many](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#resolve_many) - Resolve queue items
|
|
411
433
|
* [unresolve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#unresolve) - Unresolve a queue item
|
|
412
434
|
|
|
413
435
|
### [Webhooks](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/webhooks/README.md)
|
|
@@ -425,6 +447,7 @@ Create the organization client only where you manage projects and channels, for
|
|
|
425
447
|
### [Wordlist](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md)
|
|
426
448
|
|
|
427
449
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#list) - List wordlists
|
|
450
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#create) - Create wordlist
|
|
428
451
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#retrieve) - Get wordlist
|
|
429
452
|
* [update](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#update) - Update wordlist
|
|
430
453
|
* [get_embedding_status](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#get_embedding_status) - Get embedding status
|
|
@@ -480,13 +503,11 @@ with ModerationAPI(
|
|
|
480
503
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
481
504
|
) as ma_client:
|
|
482
505
|
|
|
483
|
-
res = ma_client.
|
|
506
|
+
res = ma_client.analytics.summary(range="30d",
|
|
484
507
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
485
508
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
res = res.next()
|
|
509
|
+
# Handle response
|
|
510
|
+
print(res)
|
|
490
511
|
|
|
491
512
|
```
|
|
492
513
|
|
|
@@ -502,12 +523,10 @@ with ModerationAPI(
|
|
|
502
523
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
503
524
|
) as ma_client:
|
|
504
525
|
|
|
505
|
-
res = ma_client.
|
|
506
|
-
|
|
507
|
-
while res is not None:
|
|
508
|
-
# Handle items
|
|
526
|
+
res = ma_client.analytics.summary(range="30d")
|
|
509
527
|
|
|
510
|
-
|
|
528
|
+
# Handle response
|
|
529
|
+
print(res)
|
|
511
530
|
|
|
512
531
|
```
|
|
513
532
|
<!-- End Retries [retries] -->
|
|
@@ -539,12 +558,10 @@ with ModerationAPI(
|
|
|
539
558
|
res = None
|
|
540
559
|
try:
|
|
541
560
|
|
|
542
|
-
res = ma_client.
|
|
543
|
-
|
|
544
|
-
while res is not None:
|
|
545
|
-
# Handle items
|
|
561
|
+
res = ma_client.analytics.summary(range="30d")
|
|
546
562
|
|
|
547
|
-
|
|
563
|
+
# Handle response
|
|
564
|
+
print(res)
|
|
548
565
|
|
|
549
566
|
|
|
550
567
|
except errors.ModerationAPIError as e:
|
|
@@ -569,8 +586,9 @@ with ModerationAPI(
|
|
|
569
586
|
* [`ModerationAPIError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/moderationapierror.py): The base class for HTTP error responses.
|
|
570
587
|
* [`AuthenticationError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/authenticationerror.py): The API key is missing, invalid or revoked. Status code `401`.
|
|
571
588
|
* [`RateLimitError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/ratelimiterror.py): Too many requests. Retry after the number of seconds in the `Retry-After` header. Status code `429`.
|
|
589
|
+
* [`BadRequestError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/badrequesterror.py): The request is malformed or a parameter is invalid. Status code `400`. *
|
|
572
590
|
|
|
573
|
-
<details><summary>Less common errors (
|
|
591
|
+
<details><summary>Less common errors (9)</summary>
|
|
574
592
|
|
|
575
593
|
<br />
|
|
576
594
|
|
|
@@ -581,11 +599,10 @@ with ModerationAPI(
|
|
|
581
599
|
|
|
582
600
|
|
|
583
601
|
**Inherit from [`ModerationAPIError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/moderationapierror.py)**:
|
|
584
|
-
* [`
|
|
585
|
-
* [`
|
|
586
|
-
* [`
|
|
587
|
-
* [`
|
|
588
|
-
* [`ConflictError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 42 methods.*
|
|
602
|
+
* [`NotFoundError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/notfounderror.py): The resource does not exist or the key cannot see it. Status code `404`. Applicable to 44 of 58 methods.*
|
|
603
|
+
* [`PermissionDeniedError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/permissiondeniederror.py): The API key cannot do this, or the plan limit for this resource is reached. Status code `403`. Applicable to 36 of 58 methods.*
|
|
604
|
+
* [`InternalServerError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/internalservererror.py): Something went wrong on our side. Retry with backoff. Status code `500`. Applicable to 23 of 58 methods.*
|
|
605
|
+
* [`ConflictError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 58 methods.*
|
|
589
606
|
* [`ResponseValidationError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
590
607
|
|
|
591
608
|
</details>
|
|
@@ -609,12 +626,10 @@ with ModerationAPI(
|
|
|
609
626
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
610
627
|
) as ma_client:
|
|
611
628
|
|
|
612
|
-
res = ma_client.
|
|
629
|
+
res = ma_client.analytics.summary(range="30d")
|
|
613
630
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
res = res.next()
|
|
631
|
+
# Handle response
|
|
632
|
+
print(res)
|
|
618
633
|
|
|
619
634
|
```
|
|
620
635
|
<!-- End Server Selection [server] -->
|
|
@@ -294,12 +294,10 @@ with ModerationAPI(
|
|
|
294
294
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
295
295
|
) as ma_client:
|
|
296
296
|
|
|
297
|
-
res = ma_client.
|
|
297
|
+
res = ma_client.analytics.summary(range="30d")
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
res = res.next()
|
|
299
|
+
# Handle response
|
|
300
|
+
print(res)
|
|
303
301
|
|
|
304
302
|
```
|
|
305
303
|
<!-- End Authentication [security] -->
|
|
@@ -309,9 +307,9 @@ with ModerationAPI(
|
|
|
309
307
|
Moderation API has two kinds of API keys:
|
|
310
308
|
|
|
311
309
|
- A **project key** works with one project: content, authors, review queues, actions, wordlists, webhooks and the account. Most integrations need only this key.
|
|
312
|
-
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels.
|
|
310
|
+
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels. It can also use any project's endpoints: name the project with `projectId`.
|
|
313
311
|
|
|
314
|
-
|
|
312
|
+
A project key can't call the management API: the API returns `403` with the code `organization_key_required`. If you use both kinds of key, create one client for each:
|
|
315
313
|
|
|
316
314
|
```python
|
|
317
315
|
import os
|
|
@@ -353,6 +351,15 @@ Create the organization client only where you manage projects and channels, for
|
|
|
353
351
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/actions/README.md#delete) - Delete an action
|
|
354
352
|
* [execute](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/actions/README.md#execute) - Execute moderation action
|
|
355
353
|
|
|
354
|
+
### [Analytics](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md)
|
|
355
|
+
|
|
356
|
+
* [summary](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#summary) - Get the analytics summary
|
|
357
|
+
* [policies](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#policies) - Get the most flagged policies
|
|
358
|
+
* [authors](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#authors) - Get the most flagged authors
|
|
359
|
+
* [channels](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#channels) - Get analytics per channel
|
|
360
|
+
* [volumes](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#volumes) - Get volumes over time
|
|
361
|
+
* [automation](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/analytics/README.md#automation) - Get the automation breakdown
|
|
362
|
+
|
|
356
363
|
### [Authors](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md)
|
|
357
364
|
|
|
358
365
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#list) - List authors
|
|
@@ -360,6 +367,9 @@ Create the organization client only where you manage projects and channels, for
|
|
|
360
367
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#retrieve) - Get author details
|
|
361
368
|
* [update](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#update) - Update author details
|
|
362
369
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#delete) - Delete an author
|
|
370
|
+
* [block](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#block) - Block author
|
|
371
|
+
* [suspend](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#suspend) - Suspend author
|
|
372
|
+
* [unblock](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/authors/README.md#unblock) - Unblock author
|
|
363
373
|
|
|
364
374
|
### [Channels](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/channels/README.md)
|
|
365
375
|
|
|
@@ -372,8 +382,14 @@ Create the organization client only where you manage projects and channels, for
|
|
|
372
382
|
|
|
373
383
|
### [Content](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md)
|
|
374
384
|
|
|
385
|
+
* [reject](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#reject) - Reject content
|
|
386
|
+
* [allow](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#allow) - Allow content
|
|
375
387
|
* [submit](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/contentsdk/README.md#submit) - Submit content
|
|
376
388
|
|
|
389
|
+
### [Feedback](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/feedback/README.md)
|
|
390
|
+
|
|
391
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/feedback/README.md#create) - Send feedback
|
|
392
|
+
|
|
377
393
|
### [Projects](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md)
|
|
378
394
|
|
|
379
395
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#list) - List projects
|
|
@@ -383,15 +399,21 @@ Create the organization client only where you manage projects and channels, for
|
|
|
383
399
|
* [delete](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#delete) - Delete a project
|
|
384
400
|
* [duplicate](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/projects/README.md#duplicate) - Duplicate a project
|
|
385
401
|
|
|
402
|
+
#### [Projects.ApiKeys](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/apikeys/README.md)
|
|
403
|
+
|
|
404
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/apikeys/README.md#create) - Create a project API key
|
|
405
|
+
|
|
386
406
|
### [Queue](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md)
|
|
387
407
|
|
|
408
|
+
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#list) - List queues
|
|
388
409
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#retrieve) - Get a queue
|
|
389
410
|
* [get_stats](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/queuesdk/README.md#get_stats) - Get queue statistics
|
|
390
411
|
|
|
391
412
|
#### [Queue.Items](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md)
|
|
392
413
|
|
|
393
|
-
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#list) -
|
|
414
|
+
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#list) - List queue items
|
|
394
415
|
* [resolve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#resolve) - Resolve a queue item
|
|
416
|
+
* [resolve_many](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#resolve_many) - Resolve queue items
|
|
395
417
|
* [unresolve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/items/README.md#unresolve) - Unresolve a queue item
|
|
396
418
|
|
|
397
419
|
### [Webhooks](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/webhooks/README.md)
|
|
@@ -409,6 +431,7 @@ Create the organization client only where you manage projects and channels, for
|
|
|
409
431
|
### [Wordlist](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md)
|
|
410
432
|
|
|
411
433
|
* [list](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#list) - List wordlists
|
|
434
|
+
* [create](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#create) - Create wordlist
|
|
412
435
|
* [retrieve](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#retrieve) - Get wordlist
|
|
413
436
|
* [update](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#update) - Update wordlist
|
|
414
437
|
* [get_embedding_status](https://github.com/moderation-api/sdk-python/blob/master/docs/sdks/wordlist/README.md#get_embedding_status) - Get embedding status
|
|
@@ -464,13 +487,11 @@ with ModerationAPI(
|
|
|
464
487
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
465
488
|
) as ma_client:
|
|
466
489
|
|
|
467
|
-
res = ma_client.
|
|
490
|
+
res = ma_client.analytics.summary(range="30d",
|
|
468
491
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
469
492
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
res = res.next()
|
|
493
|
+
# Handle response
|
|
494
|
+
print(res)
|
|
474
495
|
|
|
475
496
|
```
|
|
476
497
|
|
|
@@ -486,12 +507,10 @@ with ModerationAPI(
|
|
|
486
507
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
487
508
|
) as ma_client:
|
|
488
509
|
|
|
489
|
-
res = ma_client.
|
|
490
|
-
|
|
491
|
-
while res is not None:
|
|
492
|
-
# Handle items
|
|
510
|
+
res = ma_client.analytics.summary(range="30d")
|
|
493
511
|
|
|
494
|
-
|
|
512
|
+
# Handle response
|
|
513
|
+
print(res)
|
|
495
514
|
|
|
496
515
|
```
|
|
497
516
|
<!-- End Retries [retries] -->
|
|
@@ -523,12 +542,10 @@ with ModerationAPI(
|
|
|
523
542
|
res = None
|
|
524
543
|
try:
|
|
525
544
|
|
|
526
|
-
res = ma_client.
|
|
527
|
-
|
|
528
|
-
while res is not None:
|
|
529
|
-
# Handle items
|
|
545
|
+
res = ma_client.analytics.summary(range="30d")
|
|
530
546
|
|
|
531
|
-
|
|
547
|
+
# Handle response
|
|
548
|
+
print(res)
|
|
532
549
|
|
|
533
550
|
|
|
534
551
|
except errors.ModerationAPIError as e:
|
|
@@ -553,8 +570,9 @@ with ModerationAPI(
|
|
|
553
570
|
* [`ModerationAPIError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/moderationapierror.py): The base class for HTTP error responses.
|
|
554
571
|
* [`AuthenticationError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/authenticationerror.py): The API key is missing, invalid or revoked. Status code `401`.
|
|
555
572
|
* [`RateLimitError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/ratelimiterror.py): Too many requests. Retry after the number of seconds in the `Retry-After` header. Status code `429`.
|
|
573
|
+
* [`BadRequestError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/badrequesterror.py): The request is malformed or a parameter is invalid. Status code `400`. *
|
|
556
574
|
|
|
557
|
-
<details><summary>Less common errors (
|
|
575
|
+
<details><summary>Less common errors (9)</summary>
|
|
558
576
|
|
|
559
577
|
<br />
|
|
560
578
|
|
|
@@ -565,11 +583,10 @@ with ModerationAPI(
|
|
|
565
583
|
|
|
566
584
|
|
|
567
585
|
**Inherit from [`ModerationAPIError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/moderationapierror.py)**:
|
|
568
|
-
* [`
|
|
569
|
-
* [`
|
|
570
|
-
* [`
|
|
571
|
-
* [`
|
|
572
|
-
* [`ConflictError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 42 methods.*
|
|
586
|
+
* [`NotFoundError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/notfounderror.py): The resource does not exist or the key cannot see it. Status code `404`. Applicable to 44 of 58 methods.*
|
|
587
|
+
* [`PermissionDeniedError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/permissiondeniederror.py): The API key cannot do this, or the plan limit for this resource is reached. Status code `403`. Applicable to 36 of 58 methods.*
|
|
588
|
+
* [`InternalServerError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/internalservererror.py): Something went wrong on our side. Retry with backoff. Status code `500`. Applicable to 23 of 58 methods.*
|
|
589
|
+
* [`ConflictError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 58 methods.*
|
|
573
590
|
* [`ResponseValidationError`](https://github.com/moderation-api/sdk-python/blob/master/./src/moderation_api/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
574
591
|
|
|
575
592
|
</details>
|
|
@@ -593,12 +610,10 @@ with ModerationAPI(
|
|
|
593
610
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
594
611
|
) as ma_client:
|
|
595
612
|
|
|
596
|
-
res = ma_client.
|
|
613
|
+
res = ma_client.analytics.summary(range="30d")
|
|
597
614
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
res = res.next()
|
|
615
|
+
# Handle response
|
|
616
|
+
print(res)
|
|
602
617
|
|
|
603
618
|
```
|
|
604
619
|
<!-- End Server Selection [server] -->
|
|
@@ -294,12 +294,10 @@ with ModerationAPI(
|
|
|
294
294
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
295
295
|
) as ma_client:
|
|
296
296
|
|
|
297
|
-
res = ma_client.
|
|
297
|
+
res = ma_client.analytics.summary(range="30d")
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
res = res.next()
|
|
299
|
+
# Handle response
|
|
300
|
+
print(res)
|
|
303
301
|
|
|
304
302
|
```
|
|
305
303
|
<!-- End Authentication [security] -->
|
|
@@ -309,9 +307,9 @@ with ModerationAPI(
|
|
|
309
307
|
Moderation API has two kinds of API keys:
|
|
310
308
|
|
|
311
309
|
- A **project key** works with one project: content, authors, review queues, actions, wordlists, webhooks and the account. Most integrations need only this key.
|
|
312
|
-
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels.
|
|
310
|
+
- An **organization key** works with the [management API](https://docs.moderationapi.com/api-reference/management-api): projects and channels. It can also use any project's endpoints: name the project with `projectId`.
|
|
313
311
|
|
|
314
|
-
|
|
312
|
+
A project key can't call the management API: the API returns `403` with the code `organization_key_required`. If you use both kinds of key, create one client for each:
|
|
315
313
|
|
|
316
314
|
```python
|
|
317
315
|
import os
|
|
@@ -353,6 +351,15 @@ Create the organization client only where you manage projects and channels, for
|
|
|
353
351
|
* [delete](docs/sdks/actions/README.md#delete) - Delete an action
|
|
354
352
|
* [execute](docs/sdks/actions/README.md#execute) - Execute moderation action
|
|
355
353
|
|
|
354
|
+
### [Analytics](docs/sdks/analytics/README.md)
|
|
355
|
+
|
|
356
|
+
* [summary](docs/sdks/analytics/README.md#summary) - Get the analytics summary
|
|
357
|
+
* [policies](docs/sdks/analytics/README.md#policies) - Get the most flagged policies
|
|
358
|
+
* [authors](docs/sdks/analytics/README.md#authors) - Get the most flagged authors
|
|
359
|
+
* [channels](docs/sdks/analytics/README.md#channels) - Get analytics per channel
|
|
360
|
+
* [volumes](docs/sdks/analytics/README.md#volumes) - Get volumes over time
|
|
361
|
+
* [automation](docs/sdks/analytics/README.md#automation) - Get the automation breakdown
|
|
362
|
+
|
|
356
363
|
### [Authors](docs/sdks/authors/README.md)
|
|
357
364
|
|
|
358
365
|
* [list](docs/sdks/authors/README.md#list) - List authors
|
|
@@ -360,6 +367,9 @@ Create the organization client only where you manage projects and channels, for
|
|
|
360
367
|
* [retrieve](docs/sdks/authors/README.md#retrieve) - Get author details
|
|
361
368
|
* [update](docs/sdks/authors/README.md#update) - Update author details
|
|
362
369
|
* [delete](docs/sdks/authors/README.md#delete) - Delete an author
|
|
370
|
+
* [block](docs/sdks/authors/README.md#block) - Block author
|
|
371
|
+
* [suspend](docs/sdks/authors/README.md#suspend) - Suspend author
|
|
372
|
+
* [unblock](docs/sdks/authors/README.md#unblock) - Unblock author
|
|
363
373
|
|
|
364
374
|
### [Channels](docs/sdks/channels/README.md)
|
|
365
375
|
|
|
@@ -372,8 +382,14 @@ Create the organization client only where you manage projects and channels, for
|
|
|
372
382
|
|
|
373
383
|
### [Content](docs/sdks/contentsdk/README.md)
|
|
374
384
|
|
|
385
|
+
* [reject](docs/sdks/contentsdk/README.md#reject) - Reject content
|
|
386
|
+
* [allow](docs/sdks/contentsdk/README.md#allow) - Allow content
|
|
375
387
|
* [submit](docs/sdks/contentsdk/README.md#submit) - Submit content
|
|
376
388
|
|
|
389
|
+
### [Feedback](docs/sdks/feedback/README.md)
|
|
390
|
+
|
|
391
|
+
* [create](docs/sdks/feedback/README.md#create) - Send feedback
|
|
392
|
+
|
|
377
393
|
### [Projects](docs/sdks/projects/README.md)
|
|
378
394
|
|
|
379
395
|
* [list](docs/sdks/projects/README.md#list) - List projects
|
|
@@ -383,15 +399,21 @@ Create the organization client only where you manage projects and channels, for
|
|
|
383
399
|
* [delete](docs/sdks/projects/README.md#delete) - Delete a project
|
|
384
400
|
* [duplicate](docs/sdks/projects/README.md#duplicate) - Duplicate a project
|
|
385
401
|
|
|
402
|
+
#### [Projects.ApiKeys](docs/sdks/apikeys/README.md)
|
|
403
|
+
|
|
404
|
+
* [create](docs/sdks/apikeys/README.md#create) - Create a project API key
|
|
405
|
+
|
|
386
406
|
### [Queue](docs/sdks/queuesdk/README.md)
|
|
387
407
|
|
|
408
|
+
* [list](docs/sdks/queuesdk/README.md#list) - List queues
|
|
388
409
|
* [retrieve](docs/sdks/queuesdk/README.md#retrieve) - Get a queue
|
|
389
410
|
* [get_stats](docs/sdks/queuesdk/README.md#get_stats) - Get queue statistics
|
|
390
411
|
|
|
391
412
|
#### [Queue.Items](docs/sdks/items/README.md)
|
|
392
413
|
|
|
393
|
-
* [list](docs/sdks/items/README.md#list) -
|
|
414
|
+
* [list](docs/sdks/items/README.md#list) - List queue items
|
|
394
415
|
* [resolve](docs/sdks/items/README.md#resolve) - Resolve a queue item
|
|
416
|
+
* [resolve_many](docs/sdks/items/README.md#resolve_many) - Resolve queue items
|
|
395
417
|
* [unresolve](docs/sdks/items/README.md#unresolve) - Unresolve a queue item
|
|
396
418
|
|
|
397
419
|
### [Webhooks](docs/sdks/webhooks/README.md)
|
|
@@ -409,6 +431,7 @@ Create the organization client only where you manage projects and channels, for
|
|
|
409
431
|
### [Wordlist](docs/sdks/wordlist/README.md)
|
|
410
432
|
|
|
411
433
|
* [list](docs/sdks/wordlist/README.md#list) - List wordlists
|
|
434
|
+
* [create](docs/sdks/wordlist/README.md#create) - Create wordlist
|
|
412
435
|
* [retrieve](docs/sdks/wordlist/README.md#retrieve) - Get wordlist
|
|
413
436
|
* [update](docs/sdks/wordlist/README.md#update) - Update wordlist
|
|
414
437
|
* [get_embedding_status](docs/sdks/wordlist/README.md#get_embedding_status) - Get embedding status
|
|
@@ -464,13 +487,11 @@ with ModerationAPI(
|
|
|
464
487
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
465
488
|
) as ma_client:
|
|
466
489
|
|
|
467
|
-
res = ma_client.
|
|
490
|
+
res = ma_client.analytics.summary(range="30d",
|
|
468
491
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
469
492
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
res = res.next()
|
|
493
|
+
# Handle response
|
|
494
|
+
print(res)
|
|
474
495
|
|
|
475
496
|
```
|
|
476
497
|
|
|
@@ -486,12 +507,10 @@ with ModerationAPI(
|
|
|
486
507
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
487
508
|
) as ma_client:
|
|
488
509
|
|
|
489
|
-
res = ma_client.
|
|
490
|
-
|
|
491
|
-
while res is not None:
|
|
492
|
-
# Handle items
|
|
510
|
+
res = ma_client.analytics.summary(range="30d")
|
|
493
511
|
|
|
494
|
-
|
|
512
|
+
# Handle response
|
|
513
|
+
print(res)
|
|
495
514
|
|
|
496
515
|
```
|
|
497
516
|
<!-- End Retries [retries] -->
|
|
@@ -523,12 +542,10 @@ with ModerationAPI(
|
|
|
523
542
|
res = None
|
|
524
543
|
try:
|
|
525
544
|
|
|
526
|
-
res = ma_client.
|
|
527
|
-
|
|
528
|
-
while res is not None:
|
|
529
|
-
# Handle items
|
|
545
|
+
res = ma_client.analytics.summary(range="30d")
|
|
530
546
|
|
|
531
|
-
|
|
547
|
+
# Handle response
|
|
548
|
+
print(res)
|
|
532
549
|
|
|
533
550
|
|
|
534
551
|
except errors.ModerationAPIError as e:
|
|
@@ -553,8 +570,9 @@ with ModerationAPI(
|
|
|
553
570
|
* [`ModerationAPIError`](./src/moderation_api/errors/moderationapierror.py): The base class for HTTP error responses.
|
|
554
571
|
* [`AuthenticationError`](./src/moderation_api/errors/authenticationerror.py): The API key is missing, invalid or revoked. Status code `401`.
|
|
555
572
|
* [`RateLimitError`](./src/moderation_api/errors/ratelimiterror.py): Too many requests. Retry after the number of seconds in the `Retry-After` header. Status code `429`.
|
|
573
|
+
* [`BadRequestError`](./src/moderation_api/errors/badrequesterror.py): The request is malformed or a parameter is invalid. Status code `400`. *
|
|
556
574
|
|
|
557
|
-
<details><summary>Less common errors (
|
|
575
|
+
<details><summary>Less common errors (9)</summary>
|
|
558
576
|
|
|
559
577
|
<br />
|
|
560
578
|
|
|
@@ -565,11 +583,10 @@ with ModerationAPI(
|
|
|
565
583
|
|
|
566
584
|
|
|
567
585
|
**Inherit from [`ModerationAPIError`](./src/moderation_api/errors/moderationapierror.py)**:
|
|
568
|
-
* [`
|
|
569
|
-
* [`
|
|
570
|
-
* [`
|
|
571
|
-
* [`
|
|
572
|
-
* [`ConflictError`](./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 42 methods.*
|
|
586
|
+
* [`NotFoundError`](./src/moderation_api/errors/notfounderror.py): The resource does not exist or the key cannot see it. Status code `404`. Applicable to 44 of 58 methods.*
|
|
587
|
+
* [`PermissionDeniedError`](./src/moderation_api/errors/permissiondeniederror.py): The API key cannot do this, or the plan limit for this resource is reached. Status code `403`. Applicable to 36 of 58 methods.*
|
|
588
|
+
* [`InternalServerError`](./src/moderation_api/errors/internalservererror.py): Something went wrong on our side. Retry with backoff. Status code `500`. Applicable to 23 of 58 methods.*
|
|
589
|
+
* [`ConflictError`](./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 58 methods.*
|
|
573
590
|
* [`ResponseValidationError`](./src/moderation_api/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
574
591
|
|
|
575
592
|
</details>
|
|
@@ -593,12 +610,10 @@ with ModerationAPI(
|
|
|
593
610
|
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
|
|
594
611
|
) as ma_client:
|
|
595
612
|
|
|
596
|
-
res = ma_client.
|
|
613
|
+
res = ma_client.analytics.summary(range="30d")
|
|
597
614
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
res = res.next()
|
|
615
|
+
# Handle response
|
|
616
|
+
print(res)
|
|
602
617
|
|
|
603
618
|
```
|
|
604
619
|
<!-- End Server Selection [server] -->
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "moderation_api"
|
|
6
|
-
__version__: str = "2.
|
|
6
|
+
__version__: str = "2.3.0"
|
|
7
7
|
__openapi_doc_version__: str = "1.1.0"
|
|
8
8
|
__gen_version__: str = "internal"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 2.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 2.3.0 internal 1.1.0 moderation_api"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -23,7 +23,7 @@ class Account(BaseSDK):
|
|
|
23
23
|
|
|
24
24
|
Get account details
|
|
25
25
|
|
|
26
|
-
:param project_id: The project to act on,
|
|
26
|
+
:param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.
|
|
27
27
|
:param retries: Override the default retry configuration for this method
|
|
28
28
|
:param server_url: Override the default server URL for this method
|
|
29
29
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -122,7 +122,7 @@ class Account(BaseSDK):
|
|
|
122
122
|
|
|
123
123
|
Get account details
|
|
124
124
|
|
|
125
|
-
:param project_id: The project to act on,
|
|
125
|
+
:param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.
|
|
126
126
|
:param retries: Override the default retry configuration for this method
|
|
127
127
|
:param server_url: Override the default server URL for this method
|
|
128
128
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|