bisibility 0.2.1__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.
- bisibility-0.2.1/.gitignore +22 -0
- bisibility-0.2.1/LICENSE +201 -0
- bisibility-0.2.1/NOTICE +5 -0
- bisibility-0.2.1/PKG-INFO +383 -0
- bisibility-0.2.1/README.md +351 -0
- bisibility-0.2.1/pyproject.toml +77 -0
- bisibility-0.2.1/src/bisibility/__init__.py +385 -0
- bisibility-0.2.1/src/bisibility/client.py +2199 -0
- bisibility-0.2.1/src/bisibility/errors.py +124 -0
- bisibility-0.2.1/src/bisibility/models.py +1295 -0
- bisibility-0.2.1/src/bisibility/py.typed +1 -0
- bisibility-0.2.1/tests/test_client.py +3278 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.mypy_cache/
|
|
7
|
+
.ruff_cache/
|
|
8
|
+
.coverage
|
|
9
|
+
coverage.xml
|
|
10
|
+
coverage/*
|
|
11
|
+
!coverage/operations.json
|
|
12
|
+
htmlcov/
|
|
13
|
+
|
|
14
|
+
build/
|
|
15
|
+
dist/
|
|
16
|
+
*.egg-info/
|
|
17
|
+
|
|
18
|
+
.env
|
|
19
|
+
.env.*
|
|
20
|
+
!.env.example
|
|
21
|
+
|
|
22
|
+
.DS_Store
|
bisibility-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
bisibility-0.2.1/NOTICE
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bisibility
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Python SDK for the Bisibility REST API.
|
|
5
|
+
Project-URL: Homepage, https://bisibility.com
|
|
6
|
+
Project-URL: Documentation, https://bisibility.com/docs/api
|
|
7
|
+
Project-URL: Source, https://github.com/CorgiCorner/bisibility-sdk-python
|
|
8
|
+
Author: Bisibility
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: api,bisibility,rank-tracking,sdk,seo
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx<1,>=0.27
|
|
24
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: hatchling>=1.25; extra == 'dev'
|
|
27
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8.2; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# bisibility
|
|
34
|
+
|
|
35
|
+
> Part of [bisibility](https://github.com/CorgiCorner/bisibility) - open-source keyword
|
|
36
|
+
> rank tracking you can self-host and automate. This repository contains the Python SDK
|
|
37
|
+
> for the Bisibility REST API.
|
|
38
|
+
>
|
|
39
|
+
> [Docs](https://bisibility.com/docs) ·
|
|
40
|
+
> [API reference](https://bisibility.com/docs/api/overview) ·
|
|
41
|
+
> [Roadmap](https://bisibility.com/roadmap)
|
|
42
|
+
>
|
|
43
|
+
> **Status:** In development; not yet published to PyPI.
|
|
44
|
+
|
|
45
|
+
Python SDK for the Bisibility REST API.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pip install bisibility
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For local development:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pip install -e .[dev]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quickstart
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import os
|
|
63
|
+
|
|
64
|
+
from bisibility import BisibilityClient
|
|
65
|
+
|
|
66
|
+
bisibility = BisibilityClient(api_key=os.environ["BISIBILITY_API_KEY"])
|
|
67
|
+
|
|
68
|
+
projects = bisibility.list_projects()
|
|
69
|
+
project_id = projects.data[0].id if projects.data else None
|
|
70
|
+
|
|
71
|
+
if project_id:
|
|
72
|
+
created = bisibility.create_keywords(
|
|
73
|
+
project_id,
|
|
74
|
+
{
|
|
75
|
+
"keywords": [
|
|
76
|
+
{
|
|
77
|
+
"keyword": "rank tracker api",
|
|
78
|
+
"target_url": "https://example.com/rank-tracker",
|
|
79
|
+
"tags": ["api"],
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
keyword_id = created.results[0].keyword.id if created.results else None
|
|
86
|
+
if keyword_id:
|
|
87
|
+
check = bisibility.run_rank_check(keyword_id)
|
|
88
|
+
print(check.position, check.ranking_url)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from bisibility import BisibilityClient
|
|
95
|
+
|
|
96
|
+
bisibility = BisibilityClient(
|
|
97
|
+
api_key="bsk_live_...",
|
|
98
|
+
base_url="https://bisibility.com/api/v1",
|
|
99
|
+
timeout=30.0,
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`base_url` should point at the API v1 root. Protected methods send
|
|
104
|
+
`Authorization: Bearer <api_key>`. Write methods accept `RequestOptions` with an
|
|
105
|
+
`idempotency_key`, which maps to the server `Idempotency-Key` header.
|
|
106
|
+
|
|
107
|
+
The client accepts project API keys (`bsk_live_...`) and personal access tokens
|
|
108
|
+
(`bsp_live_...`). For a PAT with multiple project memberships, pass
|
|
109
|
+
`project_id="prj_abc123"` to send `X-Bisibility-Project` on project-implicit
|
|
110
|
+
routes. PAT methods include `get_me`, `create_project`, personal-token
|
|
111
|
+
self-management, project API-key minting, and webhook CRUD.
|
|
112
|
+
|
|
113
|
+
The default timeout is 30 seconds per attempt. Pass `timeout=None` to the client
|
|
114
|
+
to opt out globally, or `RequestOptions(timeout=None)` for one request. The SDK
|
|
115
|
+
sends `User-Agent: bisibility-sdk-python/<version>` unless you supplied a user
|
|
116
|
+
agent, and always sends the matching `X-Bisibility-Client` header.
|
|
117
|
+
|
|
118
|
+
### Retries
|
|
119
|
+
|
|
120
|
+
Failed requests are retried automatically up to `max_retries` times (default 2)
|
|
121
|
+
when the failure is an `httpx` transport error or a `429`/`503` response. Only
|
|
122
|
+
requests that are safe to replay are retried: idempotent
|
|
123
|
+
`GET`/`HEAD`/`PUT`/`DELETE` requests are always eligible, while non-idempotent
|
|
124
|
+
`POST`/`PATCH` requests are retried only when an `Idempotency-Key` header is present (set via
|
|
125
|
+
`RequestOptions(idempotency_key=...)`). When
|
|
126
|
+
the server sends a `Retry-After` header in seconds or HTTP-date form, the client
|
|
127
|
+
waits that long (capped at 60 seconds); otherwise it uses capped exponential
|
|
128
|
+
backoff (0.5s, 1s, 2s, ... up to 8s). Set `max_retries=0` to disable retries.
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
bisibility = BisibilityClient(api_key="bsk_live_...", max_retries=3)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from bisibility import RequestOptions
|
|
136
|
+
|
|
137
|
+
bisibility.create_api_key(
|
|
138
|
+
{"name": "CI"},
|
|
139
|
+
request_options=RequestOptions(idempotency_key="request-123"),
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Methods
|
|
144
|
+
|
|
145
|
+
- Discovery: `get_health`, `get_open_api`, `get_capabilities`, `get_llms_text`
|
|
146
|
+
- Public cost (no auth): `get_provider_rates`, `get_cost_estimate`
|
|
147
|
+
- Projects: `list_projects`, `get_project`, `update_project`, `delete_project`,
|
|
148
|
+
`update_project_defaults`
|
|
149
|
+
- API keys: `list_api_keys`, `create_api_key`, `revoke_api_key`
|
|
150
|
+
- Keywords: `list_keywords`, `create_keywords`, `add_keywords`, `get_keyword`,
|
|
151
|
+
`update_keyword`, `set_keyword_target_url`, `delete_keyword`, `bulk_update_keywords`
|
|
152
|
+
- Keyword research: `research_keywords` for one seed and `get_keyword_metrics` for
|
|
153
|
+
batches of up to 700 keywords. Both require API write scope because a cache miss can
|
|
154
|
+
spend provider budget. Pass `estimate_only=True` for a free cache-aware dry run and
|
|
155
|
+
`max_cost_cents` for a best-effort request guard. Research source diagnostics report
|
|
156
|
+
`ok`, `failed`, or `skipped`, including a machine-readable reason when applicable.
|
|
157
|
+
Both methods expose nullable provider metrics, cache metadata, and paid BYO-key cost.
|
|
158
|
+
- Rank checks: `list_rank_checks`, `run_rank_check`, `get_rank_check_result`
|
|
159
|
+
- Signals: `create_signal`, `list_project_signals`
|
|
160
|
+
- Alert rules: `list_alert_rules`, `create_alert_rule`, `update_alert_rule`,
|
|
161
|
+
`delete_alert_rule`, `list_triggered_alerts`, `mute_triggered_alert`,
|
|
162
|
+
`mark_project_alerts_read`
|
|
163
|
+
- Rank-history export: `export_rank_history` for typed cursor-paginated JSON or raw CSV text
|
|
164
|
+
- Sitemap monitors: `list_sitemap_monitors`, `update_sitemap_monitor`
|
|
165
|
+
- Team: `list_team_members`, `list_team_invites`, `create_team_invite`,
|
|
166
|
+
`revoke_project_team_invite`, `revoke_team_invite`
|
|
167
|
+
- Providers: `list_providers`, `connect_provider`, `test_provider_connection`,
|
|
168
|
+
`update_provider_settings`, `set_provider_enabled`, `set_provider_priority`,
|
|
169
|
+
`set_primary_provider`, `disconnect_provider`
|
|
170
|
+
- Saved views: `list_saved_views`, `create_saved_view`, `delete_project_saved_view`,
|
|
171
|
+
`delete_saved_view`
|
|
172
|
+
- Competitors: `list_competitors`, `add_competitor`, `remove_project_competitor`,
|
|
173
|
+
`remove_competitor`
|
|
174
|
+
- Notification preferences: `get_notification_preferences`, `update_notification_preferences`
|
|
175
|
+
- Migration tokens: `list_migration_tokens`, `mint_migration_token`,
|
|
176
|
+
`revoke_project_migration_token`, `revoke_migration_token`
|
|
177
|
+
|
|
178
|
+
List methods return `ListResponse[T]` with `data` and `meta.next_cursor`. Resource
|
|
179
|
+
methods return pydantic models matching the Bisibility API response shape.
|
|
180
|
+
|
|
181
|
+
Keyword research uses a single seed and a result limit of 100, 300, or 500. Metrics
|
|
182
|
+
requests accept at most 700 keywords per call, matching the REST contract. Split larger
|
|
183
|
+
batches explicitly so each response retains its own cache counts and provider cost.
|
|
184
|
+
|
|
185
|
+
Cursor-paginated resources also expose lazy `iter_*` generators. They preserve
|
|
186
|
+
the supplied filters, request pages only as needed, and stop when
|
|
187
|
+
`meta.next_cursor` is `None`:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from bisibility import ListKeywordsOptions
|
|
191
|
+
|
|
192
|
+
for keyword in bisibility.iter_keywords(
|
|
193
|
+
"prj_123",
|
|
194
|
+
ListKeywordsOptions(tag="Product", limit=100),
|
|
195
|
+
):
|
|
196
|
+
print(keyword.text)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Iterators are available for keywords, rank checks, signals, API keys (including
|
|
200
|
+
project API keys), webhooks, alert rules, triggered alerts, team members, team
|
|
201
|
+
invites, providers, saved views, competitors, and migration tokens.
|
|
202
|
+
|
|
203
|
+
### Webhook secret rotation
|
|
204
|
+
|
|
205
|
+
To rotate a webhook secret, set `hmac_secret` on `WebhookUpdateInput` to a
|
|
206
|
+
non-empty string. Sending a null, empty, or whitespace-only secret is rejected.
|
|
207
|
+
Omit `hmac_secret` entirely to leave the existing secret unchanged; omitted
|
|
208
|
+
fields are not included in the PATCH request.
|
|
209
|
+
|
|
210
|
+
All SDK-defined exceptions derive from `BisibilityError`. `BisibilityApiError`
|
|
211
|
+
also exposes `is_rate_limit`, `is_not_found`, and `retry_after_seconds` helpers.
|
|
212
|
+
Problem responses follow RFC 9457 and preserve extension members; sensitive
|
|
213
|
+
response headers are removed before an API error is exposed.
|
|
214
|
+
|
|
215
|
+
There is intentionally no `create_project` method: the API returns
|
|
216
|
+
`403 Forbidden` for `POST /projects` because project-scoped API keys cannot
|
|
217
|
+
create projects. Create projects from the Bisibility app instead.
|
|
218
|
+
|
|
219
|
+
`list_keywords` supports `country`, `device`, `tag`, `topic`, `intent`,
|
|
220
|
+
`position_gt`/`position_lt`, `search` and `sort` filters via
|
|
221
|
+
`ListKeywordsOptions` (or a plain dict); `topic` and `intent` match the keyword
|
|
222
|
+
classification fields, case-insensitively.
|
|
223
|
+
|
|
224
|
+
### Signals
|
|
225
|
+
|
|
226
|
+
Ingest deploy/CMS/API events as signals and read them back per project.
|
|
227
|
+
`create_signal` requires `source` (`"deploy"`, `"cms"`, or `"api"`) and `type`
|
|
228
|
+
(shaped like `category.event`, e.g. `"deploy.completed"`); `payload` must
|
|
229
|
+
serialize to 8KB or less. `list_project_signals` returns signals newest first
|
|
230
|
+
and accepts `source`, `type` and a `from`/`to` time range (use the `from_`
|
|
231
|
+
field name, or the `"from"` key in a dict).
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
from bisibility import CreateSignalInput, ListSignalsOptions
|
|
235
|
+
|
|
236
|
+
emitted = bisibility.create_signal(
|
|
237
|
+
CreateSignalInput(
|
|
238
|
+
source="deploy",
|
|
239
|
+
type="deploy.completed",
|
|
240
|
+
payload={"version": "1.2.3"},
|
|
241
|
+
url="https://example.com/releases/1",
|
|
242
|
+
)
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
signals = bisibility.list_project_signals(
|
|
246
|
+
"prj_123",
|
|
247
|
+
ListSignalsOptions(source="deploy", from_="2026-07-01T00:00:00Z"),
|
|
248
|
+
)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Public cost estimates
|
|
252
|
+
|
|
253
|
+
`get_provider_rates` and `get_cost_estimate` are public discovery endpoints and
|
|
254
|
+
work without an API key. `get_cost_estimate` requires `keywords` and accepts
|
|
255
|
+
`locations`, `devices` (1-2), `frequency` (`"daily"`, `"weekly"`,
|
|
256
|
+
`"monthly"`), `provider`, and a flat-rate `option` or plan `plan` selector.
|
|
257
|
+
Both return a `DataResponse` whose `data` is typed (`list[ProviderRate]` and
|
|
258
|
+
`CostEstimate`).
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
from bisibility import BisibilityClient, CostEstimateOptions
|
|
262
|
+
|
|
263
|
+
anonymous = BisibilityClient() # no api_key needed for these calls
|
|
264
|
+
|
|
265
|
+
rates = anonymous.get_provider_rates()
|
|
266
|
+
estimate = anonymous.get_cost_estimate(
|
|
267
|
+
CostEstimateOptions(keywords=248, frequency="daily", provider="dataforseo")
|
|
268
|
+
)
|
|
269
|
+
print(estimate.data.monthly_cost_usd)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Async rank checks
|
|
273
|
+
|
|
274
|
+
`run_rank_check` blocks until the check completes by default. Pass
|
|
275
|
+
`async_mode=True` to queue the check instead: the server responds with
|
|
276
|
+
`202 Accepted` and a rank check in status `"running"`; poll
|
|
277
|
+
`get_rank_check_result` until the status becomes `"completed"` or `"failed"`.
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
queued = bisibility.run_rank_check("kw_123", async_mode=True)
|
|
281
|
+
assert queued.status == "running"
|
|
282
|
+
|
|
283
|
+
result = bisibility.get_rank_check_result(queued.id)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Typed Inputs
|
|
287
|
+
|
|
288
|
+
Plain dictionaries are supported for request bodies, and pydantic input models are
|
|
289
|
+
available when you want validation and editor completion.
|
|
290
|
+
|
|
291
|
+
```python
|
|
292
|
+
from bisibility import CreateKeywordInput, CreateKeywordsBatch, KeywordScheduleInput
|
|
293
|
+
|
|
294
|
+
created = bisibility.create_keywords(
|
|
295
|
+
"prj_123",
|
|
296
|
+
CreateKeywordsBatch(
|
|
297
|
+
keywords=[
|
|
298
|
+
CreateKeywordInput(
|
|
299
|
+
keyword="rank tracker",
|
|
300
|
+
target_url="https://example.com/rank-tracker",
|
|
301
|
+
tags=["api"],
|
|
302
|
+
schedule=KeywordScheduleInput(
|
|
303
|
+
frequency="daily",
|
|
304
|
+
cron_expression=None,
|
|
305
|
+
),
|
|
306
|
+
)
|
|
307
|
+
]
|
|
308
|
+
),
|
|
309
|
+
)
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
New app-surface endpoints also have typed request models. Plain dictionaries remain supported.
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
from bisibility import (
|
|
316
|
+
AlertRuleInput,
|
|
317
|
+
ApiKeyCreateInput,
|
|
318
|
+
ConnectProviderInput,
|
|
319
|
+
ProjectDefaultsPatch,
|
|
320
|
+
ProviderCredentialsInput,
|
|
321
|
+
UpdateProjectInput,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
project = bisibility.update_project("prj_123", UpdateProjectInput(name="Marketing site"))
|
|
325
|
+
|
|
326
|
+
defaults = bisibility.update_project_defaults(
|
|
327
|
+
"prj_123",
|
|
328
|
+
ProjectDefaultsPatch(frequency="daily", location_key="US/Texas/Austin"),
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
api_key = bisibility.create_api_key(ApiKeyCreateInput(name="CI"))
|
|
332
|
+
|
|
333
|
+
rule = bisibility.create_alert_rule(
|
|
334
|
+
"prj_123",
|
|
335
|
+
AlertRuleInput(
|
|
336
|
+
channels=["email"],
|
|
337
|
+
condition_type="threshold",
|
|
338
|
+
name="Ranking drop",
|
|
339
|
+
target_type="all",
|
|
340
|
+
threshold_position=10,
|
|
341
|
+
),
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
provider = bisibility.connect_provider(
|
|
345
|
+
"prj_123",
|
|
346
|
+
"serpapi",
|
|
347
|
+
ConnectProviderInput(
|
|
348
|
+
credentials=ProviderCredentialsInput(api_key="serpapi-secret"),
|
|
349
|
+
primary=True,
|
|
350
|
+
),
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
# Self-hosted analytics providers (e.g. "plausible") accept an optional
|
|
354
|
+
# endpoint credential pointing at the instance API.
|
|
355
|
+
analytics = bisibility.connect_provider(
|
|
356
|
+
"prj_123",
|
|
357
|
+
"plausible",
|
|
358
|
+
ConnectProviderInput(
|
|
359
|
+
credentials=ProviderCredentialsInput(
|
|
360
|
+
api_key="plausible-secret",
|
|
361
|
+
endpoint="https://plausible.example.com/api",
|
|
362
|
+
),
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Errors
|
|
368
|
+
|
|
369
|
+
Non-2xx API responses raise `BisibilityApiError`. The RFC problem details body is
|
|
370
|
+
available on `error.problem` when the server returns one.
|
|
371
|
+
|
|
372
|
+
```python
|
|
373
|
+
from bisibility import BisibilityApiError
|
|
374
|
+
|
|
375
|
+
try:
|
|
376
|
+
bisibility.get_keyword("kw_missing")
|
|
377
|
+
except BisibilityApiError as error:
|
|
378
|
+
print(error.status, error.problem.detail if error.problem else error.body)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## License
|
|
382
|
+
|
|
383
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|