parseapi 1.10.3__tar.gz → 1.10.4__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.
- parseapi-1.10.3/README.md → parseapi-1.10.4/PKG-INFO +22 -17
- parseapi-1.10.3/PKG-INFO → parseapi-1.10.4/README.md +3 -36
- {parseapi-1.10.3 → parseapi-1.10.4}/api/public.json +0 -242
- {parseapi-1.10.3 → parseapi-1.10.4}/pyproject.toml +1 -2
- {parseapi-1.10.3 → parseapi-1.10.4}/smoke/smoke.py +0 -5
- {parseapi-1.10.3 → parseapi-1.10.4}/src/parseapi/__init__.py +1 -1
- {parseapi-1.10.3 → parseapi-1.10.4}/src/parseapi/_client.py +1 -69
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_client.py +1 -37
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_language.py +1 -7
- parseapi-1.10.3/tests/test_measure_response.py +0 -18
- {parseapi-1.10.3 → parseapi-1.10.4}/.github/workflows/publish.yml +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/.github/workflows/test.yml +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/.gitignore +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/CHANGELOG.md +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/LICENSE +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/scripts/public_api.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/src/parseapi/city.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/src/parseapi/py.typed +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/emoji-artwork.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/measure-response.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-company-coverage.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-company-profile.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-emoji-metadata.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-provider.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-tariff-search.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-tariff.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-time.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-timezones.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-company-coverage.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-company-profile.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-emoji-metadata.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-provider.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-tariff-search.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-tariff.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-time.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-timezones.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_card_dx.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_city_canonical.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_city_quality.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_city_query_parity.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_company_directory.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_email_enrichment.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_emoji.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_name_formatting.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_postal_localities.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_public_api.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_response_decoding.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_stack.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_time_complete.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_time_gaps.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/test_version.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.4}/tests/typing_company_directory.py +0 -0
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: parseapi
|
|
3
|
+
Version: 1.10.4
|
|
4
|
+
Summary: Official ParseAPI client for Python. One key, minimal JSON, fast.
|
|
5
|
+
Project-URL: Homepage, https://parseapi.com
|
|
6
|
+
Project-URL: Documentation, https://parseapi.com/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/parseapi/python
|
|
8
|
+
Author-email: ParseAPI <hello@parseapi.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: email validation,geolocation,ip,parseapi,phone validation,postal,timezone,weather
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Requires-Dist: httpx>=0.24
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
1
20
|
# parseapi
|
|
2
21
|
|
|
3
22
|
Official ParseAPI client for Python.
|
|
@@ -134,7 +153,6 @@ parse.point(36.0726, -79.792)
|
|
|
134
153
|
parse.weather(40.7128, -74.006)
|
|
135
154
|
parse.domain("example.com")
|
|
136
155
|
parse.asn("AS13335")
|
|
137
|
-
parse.mac("00:1B:63:84:45:E6")
|
|
138
156
|
parse.mx("example.com")
|
|
139
157
|
parse.dns("example.com")
|
|
140
158
|
parse.dns("_dmarc.example.com", type="TXT")
|
|
@@ -174,9 +192,9 @@ Choose display names for one request:
|
|
|
174
192
|
parse.country("DE", lang="fr")
|
|
175
193
|
```
|
|
176
194
|
|
|
177
|
-
`lang` is optional on geography lookups and their lists/searches,
|
|
195
|
+
`lang` is optional on geography lookups and their lists/searches, Language, Date, Time/Timezone, Emoji lookup/search. IP, ASN and national Company number lookups also accept it for their geographic labels. Codes, native names, quantities and response structure retain their meanings. Source coverage determines which labels are translated; unavailable labels use the API's documented fallback.
|
|
178
196
|
|
|
179
|
-
The next call keeps its usual default unless it also supplies `lang`. Existing `deep` rules still apply. Date `format`
|
|
197
|
+
The next call keeps its usual default unless it also supplies `lang`. Existing `deep` rules still apply. Date `format` remains an explicit input-parsing control.
|
|
180
198
|
|
|
181
199
|
## Time
|
|
182
200
|
|
|
@@ -224,19 +242,6 @@ Timezone discovery accepts country, IANA area, exact signed offset, abbreviation
|
|
|
224
242
|
|
|
225
243
|
Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offset_seconds` and `season`. Seasonal adjustments can be negative. `season` describes the current DST-flag interval, or the next within 400 days, with actual before/after transition facts and signed `change_seconds`. Unknown boundaries remain null. These fields are optional and nullable, and destination deep stays compact.
|
|
226
244
|
|
|
227
|
-
## Measurements
|
|
228
|
-
|
|
229
|
-
```python
|
|
230
|
-
result = parse.measure("5 ft 11 in", to="cm")
|
|
231
|
-
units = parse.measure.units(unit="m")
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
`amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
|
|
235
|
-
|
|
236
|
-
Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available.
|
|
237
|
-
|
|
238
|
-
Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
|
|
239
|
-
|
|
240
245
|
## Place statistics and optional detail
|
|
241
246
|
|
|
242
247
|
Australian postal lookups include core `localities` with suburb choices (`city`, `state`, `state_name`) on every plan. Null or an omitted field means unknown, while `[]` means the reviewed reference has no eligible choices. `city` stays null when the source is ambiguous, even if there is only one eligible choice. Let the user select their suburb and keep manual entry available. These are geographic choices, not mailing-address verification. [G-NAF source, adaptations and licence](https://parseapi.com/legal/attribution#postal-au).
|
|
@@ -277,7 +282,7 @@ Choose enrichment for the question you need answered.
|
|
|
277
282
|
| IP | Richer IP fields included with a paid plan. No separate check meter. |
|
|
278
283
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
279
284
|
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
|
|
280
|
-
| Phone, Time, Date,
|
|
285
|
+
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
281
286
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
282
287
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
283
288
|
| Company | The complete product detail bag on paid plans. |
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: parseapi
|
|
3
|
-
Version: 1.10.3
|
|
4
|
-
Summary: Official ParseAPI client for Python. One key, minimal JSON, fast.
|
|
5
|
-
Project-URL: Homepage, https://parseapi.com
|
|
6
|
-
Project-URL: Documentation, https://parseapi.com/docs
|
|
7
|
-
Project-URL: Repository, https://github.com/parseapi/python
|
|
8
|
-
Author-email: ParseAPI <hello@parseapi.com>
|
|
9
|
-
License-Expression: MIT
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: currency,email validation,geolocation,ip,parseapi,phone validation,postal,timezone,weather
|
|
12
|
-
Classifier: Development Status :: 4 - Beta
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
-
Requires-Python: >=3.9
|
|
17
|
-
Requires-Dist: httpx>=0.24
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
1
|
# parseapi
|
|
21
2
|
|
|
22
3
|
Official ParseAPI client for Python.
|
|
@@ -153,7 +134,6 @@ parse.point(36.0726, -79.792)
|
|
|
153
134
|
parse.weather(40.7128, -74.006)
|
|
154
135
|
parse.domain("example.com")
|
|
155
136
|
parse.asn("AS13335")
|
|
156
|
-
parse.mac("00:1B:63:84:45:E6")
|
|
157
137
|
parse.mx("example.com")
|
|
158
138
|
parse.dns("example.com")
|
|
159
139
|
parse.dns("_dmarc.example.com", type="TXT")
|
|
@@ -193,9 +173,9 @@ Choose display names for one request:
|
|
|
193
173
|
parse.country("DE", lang="fr")
|
|
194
174
|
```
|
|
195
175
|
|
|
196
|
-
`lang` is optional on geography lookups and their lists/searches,
|
|
176
|
+
`lang` is optional on geography lookups and their lists/searches, Language, Date, Time/Timezone, Emoji lookup/search. IP, ASN and national Company number lookups also accept it for their geographic labels. Codes, native names, quantities and response structure retain their meanings. Source coverage determines which labels are translated; unavailable labels use the API's documented fallback.
|
|
197
177
|
|
|
198
|
-
The next call keeps its usual default unless it also supplies `lang`. Existing `deep` rules still apply. Date `format`
|
|
178
|
+
The next call keeps its usual default unless it also supplies `lang`. Existing `deep` rules still apply. Date `format` remains an explicit input-parsing control.
|
|
199
179
|
|
|
200
180
|
## Time
|
|
201
181
|
|
|
@@ -243,19 +223,6 @@ Timezone discovery accepts country, IANA area, exact signed offset, abbreviation
|
|
|
243
223
|
|
|
244
224
|
Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offset_seconds` and `season`. Seasonal adjustments can be negative. `season` describes the current DST-flag interval, or the next within 400 days, with actual before/after transition facts and signed `change_seconds`. Unknown boundaries remain null. These fields are optional and nullable, and destination deep stays compact.
|
|
245
225
|
|
|
246
|
-
## Measurements
|
|
247
|
-
|
|
248
|
-
```python
|
|
249
|
-
result = parse.measure("5 ft 11 in", to="cm")
|
|
250
|
-
units = parse.measure.units(unit="m")
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
`amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
|
|
254
|
-
|
|
255
|
-
Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available.
|
|
256
|
-
|
|
257
|
-
Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
|
|
258
|
-
|
|
259
226
|
## Place statistics and optional detail
|
|
260
227
|
|
|
261
228
|
Australian postal lookups include core `localities` with suburb choices (`city`, `state`, `state_name`) on every plan. Null or an omitted field means unknown, while `[]` means the reviewed reference has no eligible choices. `city` stays null when the source is ambiguous, even if there is only one eligible choice. Let the user select their suburb and keep manual entry available. These are geographic choices, not mailing-address verification. [G-NAF source, adaptations and licence](https://parseapi.com/legal/attribution#postal-au).
|
|
@@ -296,7 +263,7 @@ Choose enrichment for the question you need answered.
|
|
|
296
263
|
| IP | Richer IP fields included with a paid plan. No separate check meter. |
|
|
297
264
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
298
265
|
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
|
|
299
|
-
| Phone, Time, Date,
|
|
266
|
+
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
300
267
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
301
268
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
302
269
|
| Company | The complete product detail bag on paid plans. |
|
|
@@ -1357,57 +1357,6 @@
|
|
|
1357
1357
|
],
|
|
1358
1358
|
"returns": "Json"
|
|
1359
1359
|
},
|
|
1360
|
-
"currency": {
|
|
1361
|
-
"async": true,
|
|
1362
|
-
"parameters": [
|
|
1363
|
-
{
|
|
1364
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
1365
|
-
"name": "code",
|
|
1366
|
-
"type": "str"
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
"default": false,
|
|
1370
|
-
"kind": "KEYWORD_ONLY",
|
|
1371
|
-
"name": "deep",
|
|
1372
|
-
"type": "bool"
|
|
1373
|
-
},
|
|
1374
|
-
{
|
|
1375
|
-
"default": null,
|
|
1376
|
-
"kind": "KEYWORD_ONLY",
|
|
1377
|
-
"name": "lang",
|
|
1378
|
-
"type": "Optional[str]"
|
|
1379
|
-
}
|
|
1380
|
-
],
|
|
1381
|
-
"returns": "Json"
|
|
1382
|
-
},
|
|
1383
|
-
"currency.rate": {
|
|
1384
|
-
"async": true,
|
|
1385
|
-
"parameters": [
|
|
1386
|
-
{
|
|
1387
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
1388
|
-
"name": "base",
|
|
1389
|
-
"type": "str"
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
1393
|
-
"name": "quote_currency",
|
|
1394
|
-
"type": "str"
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
"default": null,
|
|
1398
|
-
"kind": "KEYWORD_ONLY",
|
|
1399
|
-
"name": "date",
|
|
1400
|
-
"type": "Optional[str]"
|
|
1401
|
-
},
|
|
1402
|
-
{
|
|
1403
|
-
"default": null,
|
|
1404
|
-
"kind": "KEYWORD_ONLY",
|
|
1405
|
-
"name": "amount",
|
|
1406
|
-
"type": "Optional[float]"
|
|
1407
|
-
}
|
|
1408
|
-
],
|
|
1409
|
-
"returns": "Json"
|
|
1410
|
-
},
|
|
1411
1360
|
"date": {
|
|
1412
1361
|
"async": true,
|
|
1413
1362
|
"parameters": [
|
|
@@ -1991,76 +1940,6 @@
|
|
|
1991
1940
|
],
|
|
1992
1941
|
"returns": "Json"
|
|
1993
1942
|
},
|
|
1994
|
-
"mac": {
|
|
1995
|
-
"async": true,
|
|
1996
|
-
"parameters": [
|
|
1997
|
-
{
|
|
1998
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
1999
|
-
"name": "mac",
|
|
2000
|
-
"type": "str"
|
|
2001
|
-
}
|
|
2002
|
-
],
|
|
2003
|
-
"returns": "Json"
|
|
2004
|
-
},
|
|
2005
|
-
"measure": {
|
|
2006
|
-
"async": true,
|
|
2007
|
-
"parameters": [
|
|
2008
|
-
{
|
|
2009
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
2010
|
-
"name": "measure",
|
|
2011
|
-
"type": "str"
|
|
2012
|
-
},
|
|
2013
|
-
{
|
|
2014
|
-
"default": null,
|
|
2015
|
-
"kind": "KEYWORD_ONLY",
|
|
2016
|
-
"name": "to",
|
|
2017
|
-
"type": "Optional[str]"
|
|
2018
|
-
},
|
|
2019
|
-
{
|
|
2020
|
-
"default": null,
|
|
2021
|
-
"kind": "KEYWORD_ONLY",
|
|
2022
|
-
"name": "locale",
|
|
2023
|
-
"type": "Optional[str]"
|
|
2024
|
-
},
|
|
2025
|
-
{
|
|
2026
|
-
"default": null,
|
|
2027
|
-
"kind": "KEYWORD_ONLY",
|
|
2028
|
-
"name": "system",
|
|
2029
|
-
"type": "Optional[str]"
|
|
2030
|
-
}
|
|
2031
|
-
],
|
|
2032
|
-
"returns": "Json"
|
|
2033
|
-
},
|
|
2034
|
-
"measure.units": {
|
|
2035
|
-
"async": true,
|
|
2036
|
-
"parameters": [
|
|
2037
|
-
{
|
|
2038
|
-
"default": null,
|
|
2039
|
-
"kind": "KEYWORD_ONLY",
|
|
2040
|
-
"name": "query",
|
|
2041
|
-
"type": "Optional[str]"
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
"default": null,
|
|
2045
|
-
"kind": "KEYWORD_ONLY",
|
|
2046
|
-
"name": "type",
|
|
2047
|
-
"type": "Optional[str]"
|
|
2048
|
-
},
|
|
2049
|
-
{
|
|
2050
|
-
"default": null,
|
|
2051
|
-
"kind": "KEYWORD_ONLY",
|
|
2052
|
-
"name": "unit",
|
|
2053
|
-
"type": "Optional[str]"
|
|
2054
|
-
},
|
|
2055
|
-
{
|
|
2056
|
-
"default": null,
|
|
2057
|
-
"kind": "KEYWORD_ONLY",
|
|
2058
|
-
"name": "lang",
|
|
2059
|
-
"type": "Optional[str]"
|
|
2060
|
-
}
|
|
2061
|
-
],
|
|
2062
|
-
"returns": "Json"
|
|
2063
|
-
},
|
|
2064
1943
|
"mx": {
|
|
2065
1944
|
"async": true,
|
|
2066
1945
|
"parameters": [
|
|
@@ -4064,57 +3943,6 @@
|
|
|
4064
3943
|
],
|
|
4065
3944
|
"returns": "Json"
|
|
4066
3945
|
},
|
|
4067
|
-
"currency": {
|
|
4068
|
-
"async": false,
|
|
4069
|
-
"parameters": [
|
|
4070
|
-
{
|
|
4071
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
4072
|
-
"name": "code",
|
|
4073
|
-
"type": "str"
|
|
4074
|
-
},
|
|
4075
|
-
{
|
|
4076
|
-
"default": false,
|
|
4077
|
-
"kind": "KEYWORD_ONLY",
|
|
4078
|
-
"name": "deep",
|
|
4079
|
-
"type": "bool"
|
|
4080
|
-
},
|
|
4081
|
-
{
|
|
4082
|
-
"default": null,
|
|
4083
|
-
"kind": "KEYWORD_ONLY",
|
|
4084
|
-
"name": "lang",
|
|
4085
|
-
"type": "Optional[str]"
|
|
4086
|
-
}
|
|
4087
|
-
],
|
|
4088
|
-
"returns": "Json"
|
|
4089
|
-
},
|
|
4090
|
-
"currency.rate": {
|
|
4091
|
-
"async": false,
|
|
4092
|
-
"parameters": [
|
|
4093
|
-
{
|
|
4094
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
4095
|
-
"name": "base",
|
|
4096
|
-
"type": "str"
|
|
4097
|
-
},
|
|
4098
|
-
{
|
|
4099
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
4100
|
-
"name": "quote_currency",
|
|
4101
|
-
"type": "str"
|
|
4102
|
-
},
|
|
4103
|
-
{
|
|
4104
|
-
"default": null,
|
|
4105
|
-
"kind": "KEYWORD_ONLY",
|
|
4106
|
-
"name": "date",
|
|
4107
|
-
"type": "Optional[str]"
|
|
4108
|
-
},
|
|
4109
|
-
{
|
|
4110
|
-
"default": null,
|
|
4111
|
-
"kind": "KEYWORD_ONLY",
|
|
4112
|
-
"name": "amount",
|
|
4113
|
-
"type": "Optional[float]"
|
|
4114
|
-
}
|
|
4115
|
-
],
|
|
4116
|
-
"returns": "Json"
|
|
4117
|
-
},
|
|
4118
3946
|
"date": {
|
|
4119
3947
|
"async": false,
|
|
4120
3948
|
"parameters": [
|
|
@@ -4698,76 +4526,6 @@
|
|
|
4698
4526
|
],
|
|
4699
4527
|
"returns": "Json"
|
|
4700
4528
|
},
|
|
4701
|
-
"mac": {
|
|
4702
|
-
"async": false,
|
|
4703
|
-
"parameters": [
|
|
4704
|
-
{
|
|
4705
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
4706
|
-
"name": "mac",
|
|
4707
|
-
"type": "str"
|
|
4708
|
-
}
|
|
4709
|
-
],
|
|
4710
|
-
"returns": "Json"
|
|
4711
|
-
},
|
|
4712
|
-
"measure": {
|
|
4713
|
-
"async": false,
|
|
4714
|
-
"parameters": [
|
|
4715
|
-
{
|
|
4716
|
-
"kind": "POSITIONAL_OR_KEYWORD",
|
|
4717
|
-
"name": "measure",
|
|
4718
|
-
"type": "str"
|
|
4719
|
-
},
|
|
4720
|
-
{
|
|
4721
|
-
"default": null,
|
|
4722
|
-
"kind": "KEYWORD_ONLY",
|
|
4723
|
-
"name": "to",
|
|
4724
|
-
"type": "Optional[str]"
|
|
4725
|
-
},
|
|
4726
|
-
{
|
|
4727
|
-
"default": null,
|
|
4728
|
-
"kind": "KEYWORD_ONLY",
|
|
4729
|
-
"name": "locale",
|
|
4730
|
-
"type": "Optional[str]"
|
|
4731
|
-
},
|
|
4732
|
-
{
|
|
4733
|
-
"default": null,
|
|
4734
|
-
"kind": "KEYWORD_ONLY",
|
|
4735
|
-
"name": "system",
|
|
4736
|
-
"type": "Optional[str]"
|
|
4737
|
-
}
|
|
4738
|
-
],
|
|
4739
|
-
"returns": "Json"
|
|
4740
|
-
},
|
|
4741
|
-
"measure.units": {
|
|
4742
|
-
"async": false,
|
|
4743
|
-
"parameters": [
|
|
4744
|
-
{
|
|
4745
|
-
"default": null,
|
|
4746
|
-
"kind": "KEYWORD_ONLY",
|
|
4747
|
-
"name": "query",
|
|
4748
|
-
"type": "Optional[str]"
|
|
4749
|
-
},
|
|
4750
|
-
{
|
|
4751
|
-
"default": null,
|
|
4752
|
-
"kind": "KEYWORD_ONLY",
|
|
4753
|
-
"name": "type",
|
|
4754
|
-
"type": "Optional[str]"
|
|
4755
|
-
},
|
|
4756
|
-
{
|
|
4757
|
-
"default": null,
|
|
4758
|
-
"kind": "KEYWORD_ONLY",
|
|
4759
|
-
"name": "unit",
|
|
4760
|
-
"type": "Optional[str]"
|
|
4761
|
-
},
|
|
4762
|
-
{
|
|
4763
|
-
"default": null,
|
|
4764
|
-
"kind": "KEYWORD_ONLY",
|
|
4765
|
-
"name": "lang",
|
|
4766
|
-
"type": "Optional[str]"
|
|
4767
|
-
}
|
|
4768
|
-
],
|
|
4769
|
-
"returns": "Json"
|
|
4770
|
-
},
|
|
4771
4529
|
"mx": {
|
|
4772
4530
|
"async": false,
|
|
4773
4531
|
"parameters": [
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "parseapi"
|
|
7
|
-
version = "1.10.
|
|
7
|
+
version = "1.10.4"
|
|
8
8
|
description = "Official ParseAPI client for Python. One key, minimal JSON, fast."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -19,7 +19,6 @@ keywords = [
|
|
|
19
19
|
"phone validation",
|
|
20
20
|
"postal",
|
|
21
21
|
"timezone",
|
|
22
|
-
"currency",
|
|
23
22
|
"weather",
|
|
24
23
|
]
|
|
25
24
|
classifiers = [
|
|
@@ -83,16 +83,11 @@ expect_ok("caller junk free", lambda: parse.caller("555-0100"), lambda r: None i
|
|
|
83
83
|
expect_ok("hlr junk free", lambda: parse.hlr("555-0100"), lambda r: None if r["valid"] is False else "expected invalid")
|
|
84
84
|
expect_ok("domain", lambda: parse.domain("gmail.com"), lambda r: None if r["available"] is False else "gmail available?")
|
|
85
85
|
expect_ok("asn", lambda: parse.asn("AS13335"), lambda r: None if r["asn"] == 13335 else "wrong ASN")
|
|
86
|
-
expect_ok("mac", lambda: parse.mac("00:1B:63:84:45:E6"), lambda r: None if r["valid"] and r["mac"] == "00:1B:63:84:45:E6" and r["local"] is False and r["multicast"] is False else "wrong MAC")
|
|
87
|
-
expect_ok("measure", lambda: parse.measure("5 ft 11 in", to="cm"), lambda r: None if r["valid"] and r["amount"] == "180.34" and r["unit"] == "cm" else "wrong conversion")
|
|
88
|
-
expect_ok("measure.units", lambda: parse.measure.units(unit="m"), lambda r: None if any(unit["unit"] == "m" for unit in r["units"]) else "missing metre")
|
|
89
86
|
expect_ok("dns", lambda: parse.dns("example.com", type="A"), lambda r: None if any(record["type"] == "A" and isinstance(record["ttl"], int) for record in r["records"]) else "no A records")
|
|
90
87
|
expect_ok("mx", lambda: parse.mx("gmail.com"), lambda r: None if r["mx"] else "no mx")
|
|
91
88
|
expect_ok("useragent", lambda: parse.useragent(UA), lambda r: None if r["browser"] == "Chrome" else f"browser {r['browser']}")
|
|
92
89
|
|
|
93
90
|
|
|
94
|
-
expect_ok("currency", lambda: parse.currency("USD"), lambda r: None if r["symbol"] == "$" else "wrong symbol")
|
|
95
|
-
expect_ok("currency.rate", lambda: parse.currency.rate("USD", "EUR"), lambda r: None if 0 < r["rate"] < 10 else "bad rate")
|
|
96
91
|
expect_ok(
|
|
97
92
|
"language",
|
|
98
93
|
lambda: parse.language("en"),
|
|
@@ -13,7 +13,7 @@ from urllib.parse import quote
|
|
|
13
13
|
import httpx
|
|
14
14
|
from .city import CityAmbiguityCandidate, city_error_candidates
|
|
15
15
|
|
|
16
|
-
VERSION = "1.10.
|
|
16
|
+
VERSION = "1.10.4"
|
|
17
17
|
_API_VERSION = "2.0.0"
|
|
18
18
|
DEFAULT_BASE_URL = "https://api.parseapi.com"
|
|
19
19
|
DEFAULT_TIMEOUT = 10.0
|
|
@@ -212,13 +212,11 @@ class ParseAPI:
|
|
|
212
212
|
self.state = _StateSync(self)
|
|
213
213
|
self.city = _CitySync(self)
|
|
214
214
|
self.postal = _PostalSync(self)
|
|
215
|
-
self.currency = _CurrencySync(self)
|
|
216
215
|
self.holiday = _HolidaySync(self)
|
|
217
216
|
self.emoji = _EmojiSync(self)
|
|
218
217
|
self.industry = _IndustrySync(self)
|
|
219
218
|
self.naics = self.industry
|
|
220
219
|
self.date = _DateSync(self)
|
|
221
|
-
self.measure = _MeasureSync(self)
|
|
222
220
|
self.time = _TimeSync(self)
|
|
223
221
|
self.timezone = _TimezoneSync(self)
|
|
224
222
|
self.address = _AddressSync(self)
|
|
@@ -322,8 +320,6 @@ class ParseAPI:
|
|
|
322
320
|
def asn(self, asn: str, *, lang: Optional[str] = None) -> Json:
|
|
323
321
|
return self._get(f"/asn/{_seg(asn)}", {"lang": lang})
|
|
324
322
|
|
|
325
|
-
def mac(self, mac: str) -> Json:
|
|
326
|
-
return self._get(f"/mac/{_seg(mac)}")
|
|
327
323
|
|
|
328
324
|
def dns(self, domain: str, *, type: str | None = None) -> Json:
|
|
329
325
|
"""Published DNS records with TTLs. Omit type to check all supported types.
|
|
@@ -565,19 +561,6 @@ class _PostalSync:
|
|
|
565
561
|
return self._client._get(f"/postal/{_seg(from_postal)}/distance/{_seg(to_postal)}", {"country": country, "deep": deep, "lang": lang})
|
|
566
562
|
|
|
567
563
|
|
|
568
|
-
class _CurrencySync:
|
|
569
|
-
def __init__(self, client: ParseAPI):
|
|
570
|
-
self._client = client
|
|
571
|
-
|
|
572
|
-
def __call__(self, code: str, *, deep: bool = False, lang: Optional[str] = None) -> Json:
|
|
573
|
-
return self._client._get(f"/currency/{_seg(code)}", {"deep": deep, "lang": lang})
|
|
574
|
-
|
|
575
|
-
def rate(
|
|
576
|
-
self, base: str, quote_currency: str, *, date: Optional[str] = None, amount: Optional[float] = None
|
|
577
|
-
) -> Json:
|
|
578
|
-
return self._client._get(
|
|
579
|
-
f"/currency/{_seg(base)}/{_seg(quote_currency)}", {"date": date, "amount": amount}
|
|
580
|
-
)
|
|
581
564
|
|
|
582
565
|
|
|
583
566
|
class _HolidaySync:
|
|
@@ -669,13 +652,11 @@ class AsyncParseAPI:
|
|
|
669
652
|
self.state = _StateAsync(self)
|
|
670
653
|
self.city = _CityAsync(self)
|
|
671
654
|
self.postal = _PostalAsync(self)
|
|
672
|
-
self.currency = _CurrencyAsync(self)
|
|
673
655
|
self.holiday = _HolidayAsync(self)
|
|
674
656
|
self.emoji = _EmojiAsync(self)
|
|
675
657
|
self.industry = _IndustryAsync(self)
|
|
676
658
|
self.naics = self.industry
|
|
677
659
|
self.date = _DateAsync(self)
|
|
678
|
-
self.measure = _MeasureAsync(self)
|
|
679
660
|
self.time = _TimeAsync(self)
|
|
680
661
|
self.timezone = _TimezoneAsync(self)
|
|
681
662
|
self.address = _AddressAsync(self)
|
|
@@ -781,8 +762,6 @@ class AsyncParseAPI:
|
|
|
781
762
|
async def asn(self, asn: str, *, lang: Optional[str] = None) -> Json:
|
|
782
763
|
return await self._get(f"/asn/{_seg(asn)}", {"lang": lang})
|
|
783
764
|
|
|
784
|
-
async def mac(self, mac: str) -> Json:
|
|
785
|
-
return await self._get(f"/mac/{_seg(mac)}")
|
|
786
765
|
|
|
787
766
|
async def dns(self, domain: str, *, type: str | None = None) -> Json:
|
|
788
767
|
"""Published DNS records with TTLs. Omit type to check all supported types.
|
|
@@ -1026,19 +1005,6 @@ class _PostalAsync:
|
|
|
1026
1005
|
return await self._client._get(f"/postal/{_seg(from_postal)}/distance/{_seg(to_postal)}", {"country": country, "deep": deep, "lang": lang})
|
|
1027
1006
|
|
|
1028
1007
|
|
|
1029
|
-
class _CurrencyAsync:
|
|
1030
|
-
def __init__(self, client: AsyncParseAPI):
|
|
1031
|
-
self._client = client
|
|
1032
|
-
|
|
1033
|
-
async def __call__(self, code: str, *, deep: bool = False, lang: Optional[str] = None) -> Json:
|
|
1034
|
-
return await self._client._get(f"/currency/{_seg(code)}", {"deep": deep, "lang": lang})
|
|
1035
|
-
|
|
1036
|
-
async def rate(
|
|
1037
|
-
self, base: str, quote_currency: str, *, date: Optional[str] = None, amount: Optional[float] = None
|
|
1038
|
-
) -> Json:
|
|
1039
|
-
return await self._client._get(
|
|
1040
|
-
f"/currency/{_seg(base)}/{_seg(quote_currency)}", {"date": date, "amount": amount}
|
|
1041
|
-
)
|
|
1042
1008
|
|
|
1043
1009
|
|
|
1044
1010
|
class _HolidayAsync:
|
|
@@ -1219,40 +1185,6 @@ class _AddressAsync:
|
|
|
1219
1185
|
return await self._client._get("/address", {"q": query, "country": country, "postal": postal, "city": city, "state": state, "ip": ip})
|
|
1220
1186
|
|
|
1221
1187
|
|
|
1222
|
-
class _MeasureSync:
|
|
1223
|
-
def __init__(self, client: ParseAPI):
|
|
1224
|
-
self._client = client
|
|
1225
|
-
|
|
1226
|
-
def __call__(self, measure: str, *, to: Optional[str] = None, locale: Optional[str] = None, system: Optional[str] = None) -> Json:
|
|
1227
|
-
"""Parse or convert a measurement. Amount is a decimal string. Without to, use the
|
|
1228
|
-
type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
|
|
1229
|
-
Successful JSON omits reason and choices. Invalid input adds reason and alternatives add choices.
|
|
1230
|
-
Invalid measurements return valid=False and a reason. Invalid targets raise an API error.
|
|
1231
|
-
"""
|
|
1232
|
-
return self._client._get(f"/measure/{_seg(measure)}", {"to": to, "locale": locale, "system": system})
|
|
1233
|
-
|
|
1234
|
-
def units(self, *, query: Optional[str] = None, type: Optional[str] = None, unit: Optional[str] = None, lang: Optional[str] = None) -> Json:
|
|
1235
|
-
"""Discover reviewed units. unit filters compatible conversion targets."""
|
|
1236
|
-
return self._client._get("/measure/units", {"q": query, "type": type, "unit": unit, "lang": lang})
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
class _MeasureAsync:
|
|
1240
|
-
def __init__(self, client: AsyncParseAPI):
|
|
1241
|
-
self._client = client
|
|
1242
|
-
|
|
1243
|
-
async def __call__(self, measure: str, *, to: Optional[str] = None, locale: Optional[str] = None, system: Optional[str] = None) -> Json:
|
|
1244
|
-
"""Parse or convert a measurement. Amount is a decimal string. Without to, use the
|
|
1245
|
-
type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
|
|
1246
|
-
Successful JSON omits reason and choices. Invalid input adds reason and alternatives add choices.
|
|
1247
|
-
Invalid measurements return valid=False and a reason. Invalid targets raise an API error.
|
|
1248
|
-
"""
|
|
1249
|
-
return await self._client._get(f"/measure/{_seg(measure)}", {"to": to, "locale": locale, "system": system})
|
|
1250
|
-
|
|
1251
|
-
async def units(self, *, query: Optional[str] = None, type: Optional[str] = None, unit: Optional[str] = None, lang: Optional[str] = None) -> Json:
|
|
1252
|
-
"""Discover reviewed units. unit filters compatible conversion targets."""
|
|
1253
|
-
return await self._client._get("/measure/units", {"q": query, "type": type, "unit": unit, "lang": lang})
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
1188
|
class _CompanySync:
|
|
1257
1189
|
def __init__(self, client: ParseAPI, lookup: _CompanySyncClassCall):
|
|
1258
1190
|
self._client = client
|
|
@@ -49,10 +49,6 @@ URL_TABLE = [
|
|
|
49
49
|
(lambda p: p.industry.search("coffee & tea", limit=5), "https://api.parseapi.com/industry?q=coffee+%26+tea&limit=5"),
|
|
50
50
|
(lambda p: p.industry.search("plumbing"), "https://api.parseapi.com/industry?q=plumbing"),
|
|
51
51
|
(lambda p: p.name("Andrea / Smith", country="IT"), "https://api.parseapi.com/name/Andrea%20%2F%20Smith?country=IT"),
|
|
52
|
-
(lambda p: p.measure("5 ft 11 in", to="cm", locale="en-US", system="us"), "https://api.parseapi.com/measure/5%20ft%2011%20in?to=cm&locale=en-US&system=us"),
|
|
53
|
-
(lambda p: p.measure("1 kg/m^3", to="g/L"), "https://api.parseapi.com/measure/1%20kg%2Fm%5E3?to=g%2FL"),
|
|
54
|
-
(lambda p: p.measure.units(query="US gallon", type="volume", unit="L"), "https://api.parseapi.com/measure/units?q=US+gallon&type=volume&unit=L"),
|
|
55
|
-
(lambda p: p.measure.units(), "https://api.parseapi.com/measure/units"),
|
|
56
52
|
(lambda p: p.address("10 rue / Paris", country="FR"),
|
|
57
53
|
"https://api.parseapi.com/address/10%20rue%20%2F%20Paris?country=FR"),
|
|
58
54
|
(lambda p: p.address.search("10 rue", country="FR", postal="75001"),
|
|
@@ -111,19 +107,10 @@ URL_TABLE = [
|
|
|
111
107
|
(lambda p: p.domain("example.com"), "https://api.parseapi.com/domain/example.com"),
|
|
112
108
|
(lambda p: p.asn("AS13335"), "https://api.parseapi.com/asn/AS13335"),
|
|
113
109
|
(lambda p: p.asn("13335"), "https://api.parseapi.com/asn/13335"),
|
|
114
|
-
(lambda p: p.mac("00:1B:63:84:45:E6"), "https://api.parseapi.com/mac/00%3A1B%3A63%3A84%3A45%3AE6"),
|
|
115
110
|
(lambda p: p.mx("example.com"), "https://api.parseapi.com/mx/example.com"),
|
|
116
111
|
(lambda p: p.useragent("TestUA/1.0"), "https://api.parseapi.com/useragent"),
|
|
117
112
|
|
|
118
113
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
(lambda p: p.currency("USD"), "https://api.parseapi.com/currency/USD"),
|
|
122
|
-
(lambda p: p.currency.rate("USD", "EUR"), "https://api.parseapi.com/currency/USD/EUR"),
|
|
123
|
-
(
|
|
124
|
-
lambda p: p.currency.rate("USD", "JPY", date="2026-08-28", amount=100),
|
|
125
|
-
"https://api.parseapi.com/currency/USD/JPY?date=2026-08-28&amount=100",
|
|
126
|
-
),
|
|
127
114
|
(lambda p: p.language("en"), "https://api.parseapi.com/language/en"),
|
|
128
115
|
(lambda p: p.name("Smith, John"), "https://api.parseapi.com/name/Smith%2C%20John"),
|
|
129
116
|
(lambda p: p.timezone("America/New_York"), "https://api.parseapi.com/timezone/America%2FNew_York"),
|
|
@@ -398,29 +385,6 @@ def test_async_cancellation_does_not_retry():
|
|
|
398
385
|
asyncio.run(run())
|
|
399
386
|
|
|
400
387
|
|
|
401
|
-
def test_measure_decimal_and_unknown_results():
|
|
402
|
-
for body in [
|
|
403
|
-
{"measure": "0 m", "valid": True, "type": "future-type", "amount": "0", "unit": "m", "reason": None, "choices": [], "future": None},
|
|
404
|
-
{"measure": "1 gallon", "valid": False, "type": None, "amount": None, "unit": None, "reason": "ambiguous_unit", "choices": [{"unit": "us_gal", "name": "US liquid gallon"}]},
|
|
405
|
-
]:
|
|
406
|
-
client, _ = make_client(ok(body))
|
|
407
|
-
with client:
|
|
408
|
-
assert client.measure(body["measure"]) == body
|
|
409
|
-
async def check():
|
|
410
|
-
async with AsyncParseAPI("test_key", transport=httpx.MockTransport(ok(body))) as client:
|
|
411
|
-
assert await client.measure(body["measure"]) == body
|
|
412
|
-
asyncio.run(check())
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
def test_measure_invalid_target_preserves_error_without_retry():
|
|
416
|
-
client, calls = make_client(lambda request: httpx.Response(400, json={"code": "bad_request", "message": "Incompatible units", "request_id": "req_measure"}), retries=None)
|
|
417
|
-
with client, pytest.raises(ParseAPIError) as raised:
|
|
418
|
-
client.measure("1 m", to="kg")
|
|
419
|
-
assert raised.value.code == "bad_request"
|
|
420
|
-
assert raised.value.request_id == "req_measure"
|
|
421
|
-
assert len(calls) == 1
|
|
422
|
-
|
|
423
|
-
|
|
424
388
|
def test_dns_preserves_presentation_and_empty_records_sync_and_async():
|
|
425
389
|
async def run(body):
|
|
426
390
|
async with AsyncParseAPI("test_key", transport=httpx.MockTransport(ok(body))) as client:
|
|
@@ -464,7 +428,7 @@ def test_card_reference_null_false_and_error():
|
|
|
464
428
|
assert len(calls) == 0
|
|
465
429
|
|
|
466
430
|
|
|
467
|
-
ADP_CASES = [('country', ['US'], {}), ('state', ['NC'], {'country': 'US'}), ('state.districts', ['NC'], {'country': 'US'}), ('district', ['37081'], {'country': 'US', 'state': 'NC'}), ('city', ['Charlotte'], {'country': 'US', 'state': 'NC'}), ('city.id', ['city_test'], {}), ('city.search', ['Charlotte'], {'country': 'US', 'state': 'NC', 'limit': 2}), ('city.nearest', [0, 0], {}), ('city.nearby', ['Charlotte'], {'radius': 0, 'unit': 'km', 'country': 'US', 'state': 'NC', 'limit': 2}), ('postal', ['28202'], {'country': 'US'}), ('postal.nearby', ['28202'], {'country': 'US', 'radius': 0, 'unit': 'km'}), ('postal.distance', ['28202', '10001'], {'country': 'US'}), ('carrier', ['+14155552671'], {'country': 'US'}), ('hlr', ['+447712345678'], {'country': 'GB'}), ('naics', ['31-33'], {}), ('naics.search', ['coffee'], {'limit': 2}), ('
|
|
431
|
+
ADP_CASES = [('country', ['US'], {}), ('state', ['NC'], {'country': 'US'}), ('state.districts', ['NC'], {'country': 'US'}), ('district', ['37081'], {'country': 'US', 'state': 'NC'}), ('city', ['Charlotte'], {'country': 'US', 'state': 'NC'}), ('city.id', ['city_test'], {}), ('city.search', ['Charlotte'], {'country': 'US', 'state': 'NC', 'limit': 2}), ('city.nearest', [0, 0], {}), ('city.nearby', ['Charlotte'], {'radius': 0, 'unit': 'km', 'country': 'US', 'state': 'NC', 'limit': 2}), ('postal', ['28202'], {'country': 'US'}), ('postal.nearby', ['28202'], {'country': 'US', 'radius': 0, 'unit': 'km'}), ('postal.distance', ['28202', '10001'], {'country': 'US'}), ('carrier', ['+14155552671'], {'country': 'US'}), ('hlr', ['+447712345678'], {'country': 'GB'}), ('naics', ['31-33'], {}), ('naics.search', ['coffee'], {'limit': 2}), ('language', ['ar'], {}), ('name', ['Andrea'], {'country': 'IT'}), ('time', [], {'at': '2026-09-08', 'to': 'UTC'}), ('time.at', [0, 0], {'at': '2026-09-08', 'to': 'UTC'}), ('timezone', ['UTC'], {'at': '2026-09-08', 'to': 'UTC'}), ('timezone.at', [0, 0], {'at': '2026-09-08'}), ('date', ['03/04/2026'], {'format': 'dmy', 'to': '2026-09-08'}), ('date.today', [], {'to': '2026-09-08'}), ('emoji', ['fire'], {}), ('emoji.search', ['fire'], {'limit': 2})]
|
|
468
432
|
|
|
469
433
|
@pytest.mark.parametrize("method,args,options", ADP_CASES)
|
|
470
434
|
@pytest.mark.parametrize("async_mode", [False, True])
|
|
@@ -27,7 +27,6 @@ OPERATIONS = [
|
|
|
27
27
|
("postal.distance", ["28202", "10001"], {"country": "US"}),
|
|
28
28
|
("company", ["732829320"], {"country": "FR", "deep": True}),
|
|
29
29
|
("asn", ["AS13335"], {}),
|
|
30
|
-
("currency", ["USD"], {"deep": True}),
|
|
31
30
|
("language", ["ja"], {}),
|
|
32
31
|
("time", ["America/New_York"], {"at": "2026-01-01T12:00", "to": "UTC", "deep": True}),
|
|
33
32
|
("time.at", [0, 0], {"at": "2026-01-01T12:00Z"}),
|
|
@@ -38,7 +37,6 @@ OPERATIONS = [
|
|
|
38
37
|
("point", [0, 0], {"deep": True}),
|
|
39
38
|
("emoji", ["😀"], {"deep": True}),
|
|
40
39
|
("emoji.search", ["visage"], {"limit": 2}),
|
|
41
|
-
("measure.units", [], {"query": "meter", "unit": "m"}),
|
|
42
40
|
]
|
|
43
41
|
|
|
44
42
|
|
|
@@ -75,7 +73,6 @@ def test_language_is_an_optional_per_request_query(name, args, options, async_cl
|
|
|
75
73
|
assert len(calls) == 2
|
|
76
74
|
assert calls[0].url.path == calls[1].url.path
|
|
77
75
|
assert dict(calls[0].url.params) == {**dict(calls[1].url.params), "lang": "fr-CA"}
|
|
78
|
-
assert "lang" not in calls[1].url.params
|
|
79
76
|
|
|
80
77
|
|
|
81
78
|
def test_language_does_not_change_input_parsing_or_unrelated_operations():
|
|
@@ -83,9 +80,6 @@ def test_language_does_not_change_input_parsing_or_unrelated_operations():
|
|
|
83
80
|
transport = httpx.MockTransport(lambda request: (calls.append(request), httpx.Response(200, json={}))[1])
|
|
84
81
|
with ParseAPI("fixture", transport=transport) as client:
|
|
85
82
|
client.date("03/04/2026", format="dmy", lang="en-US")
|
|
86
|
-
client.measure("1,5 m", locale="de-DE", to="cm")
|
|
87
83
|
assert calls[0].url.params["format"] == "dmy"
|
|
88
|
-
|
|
89
|
-
assert "lang" not in calls[1].url.params
|
|
90
|
-
for name in ["currency.rate", "measure", "holiday", "name", "email", "phone", "address"]:
|
|
84
|
+
for name in ["holiday", "name", "email", "phone", "address"]:
|
|
91
85
|
assert "lang" not in inspect.signature(operation(client, name)).parameters
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import json
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
from parseapi import AsyncParseAPI, ParseAPI
|
|
7
|
-
|
|
8
|
-
CASES = json.loads((Path(__file__).parent / 'fixtures/measure-response.json').read_text())
|
|
9
|
-
|
|
10
|
-
def test_clean_and_legacy_measure_responses_sync_and_async():
|
|
11
|
-
for body in CASES:
|
|
12
|
-
transport = httpx.MockTransport(lambda request: httpx.Response(200, json=body))
|
|
13
|
-
with ParseAPI('fixture', transport=transport) as client:
|
|
14
|
-
assert client.measure(body['measure']) == body
|
|
15
|
-
async def check():
|
|
16
|
-
async with AsyncParseAPI('fixture', transport=transport) as client:
|
|
17
|
-
assert await client.measure(body['measure']) == body
|
|
18
|
-
asyncio.run(check())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/clean-tariff-search.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-tariff-search.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.4}/tests/fixtures/response-fixtures/standard-timezones.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|