parseapi 1.10.3__tar.gz → 1.10.5__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 → parseapi-1.10.5}/PKG-INFO +9 -21
- {parseapi-1.10.3 → parseapi-1.10.5}/README.md +7 -19
- {parseapi-1.10.3 → parseapi-1.10.5}/api/public.json +0 -242
- {parseapi-1.10.3 → parseapi-1.10.5}/pyproject.toml +1 -2
- {parseapi-1.10.3 → parseapi-1.10.5}/smoke/smoke.py +0 -5
- {parseapi-1.10.3 → parseapi-1.10.5}/src/parseapi/__init__.py +1 -1
- {parseapi-1.10.3 → parseapi-1.10.5}/src/parseapi/_client.py +1 -69
- parseapi-1.10.5/tests/fixtures/country-aq.json +70 -0
- parseapi-1.10.5/tests/fixtures/country-corrected.json +110 -0
- parseapi-1.10.5/tests/fixtures/country-de.json +95 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_client.py +1 -37
- parseapi-1.10.5/tests/test_country_corrected.py +53 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_language.py +1 -7
- parseapi-1.10.3/tests/test_measure_response.py +0 -18
- {parseapi-1.10.3 → parseapi-1.10.5}/.github/workflows/publish.yml +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/.github/workflows/test.yml +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/.gitignore +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/CHANGELOG.md +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/LICENSE +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/scripts/public_api.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/src/parseapi/city.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/src/parseapi/py.typed +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/emoji-artwork.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/measure-response.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-company-coverage.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-company-profile.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-emoji-metadata.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-provider.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-tariff-search.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-tariff.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-time.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-timezones.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-company-coverage.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-company-profile.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-emoji-catalog.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-emoji-metadata.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-provider.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-tariff-search.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-tariff.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-time.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-timezones.json +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_card_dx.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_city_canonical.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_city_quality.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_city_query_parity.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_company_directory.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_email_enrichment.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_emoji.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_name_formatting.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_postal_localities.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_public_api.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_response_decoding.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_stack.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_time_complete.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_time_gaps.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/test_version.py +0 -0
- {parseapi-1.10.3 → parseapi-1.10.5}/tests/typing_company_directory.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: parseapi
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.5
|
|
4
4
|
Summary: Official ParseAPI client for Python. One key, minimal JSON, fast.
|
|
5
5
|
Project-URL: Homepage, https://parseapi.com
|
|
6
6
|
Project-URL: Documentation, https://parseapi.com/docs
|
|
@@ -8,7 +8,7 @@ Project-URL: Repository, https://github.com/parseapi/python
|
|
|
8
8
|
Author-email: ParseAPI <hello@parseapi.com>
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Keywords:
|
|
11
|
+
Keywords: email validation,geolocation,ip,parseapi,phone validation,postal,timezone,weather
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -64,7 +64,7 @@ Pass `country` when a postal code or national phone number needs disambiguation.
|
|
|
64
64
|
|
|
65
65
|
Results are plain data. Pass a returned code or coordinate to another operation when the task needs it. Check nullable values before composing the next call.
|
|
66
66
|
|
|
67
|
-
Use `parse.postal("28202", country="US", deep=True)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `None` means unknown and `0` means known zero.
|
|
67
|
+
Use `parse.postal("28202", country="US", deep=True)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `None` means unknown and `0` means known zero.
|
|
68
68
|
|
|
69
69
|
## Company directory
|
|
70
70
|
|
|
@@ -153,7 +153,6 @@ parse.point(36.0726, -79.792)
|
|
|
153
153
|
parse.weather(40.7128, -74.006)
|
|
154
154
|
parse.domain("example.com")
|
|
155
155
|
parse.asn("AS13335")
|
|
156
|
-
parse.mac("00:1B:63:84:45:E6")
|
|
157
156
|
parse.mx("example.com")
|
|
158
157
|
parse.dns("example.com")
|
|
159
158
|
parse.dns("_dmarc.example.com", type="TXT")
|
|
@@ -193,9 +192,9 @@ Choose display names for one request:
|
|
|
193
192
|
parse.country("DE", lang="fr")
|
|
194
193
|
```
|
|
195
194
|
|
|
196
|
-
`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.
|
|
197
196
|
|
|
198
|
-
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.
|
|
199
198
|
|
|
200
199
|
## Time
|
|
201
200
|
|
|
@@ -243,21 +242,10 @@ Timezone discovery accepts country, IANA area, exact signed offset, abbreviation
|
|
|
243
242
|
|
|
244
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.
|
|
245
244
|
|
|
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
245
|
## Place statistics and optional detail
|
|
260
246
|
|
|
247
|
+
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym and country codes, continent, region and subregion, currency, calling code, `flag`, language and timezone codes, borders, bloc memberships and `capital: { name, lat, lon }`. Paid Deep adds specialist detail, including population, total area and national statistics. `gdp_usd` and `gdp_per_capita_usd` are current US dollars; `population_growth_percent`, `urban_population_percent` and `internet_users_percent` use a 0–100 percent scale (growth can be negative or exceed 100). GDP per person and these three percentages round once to two decimals in the API response. `elevation_average` is average terrain elevation in meters; `lowest_point.elevation` and `highest_point.elevation` keep their point-specific meaning. Unknown stays null and a known zero stays zero. Country tax references are grouped once as `deep.tax: { name, rate }`; the rate remains a percentage. Read capital from the Core object and read the tax name and rate from the Deep tax object.
|
|
248
|
+
|
|
261
249
|
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).
|
|
262
250
|
|
|
263
251
|
Postal and District paid profiles include `deep.property_tax` where supported. It contains `annual_median`, `currency` and `period`: median annual property tax payable on owner-occupied homes in the statistical area. The amount is adjusted to the final year of the reporting period (`YYYY-YYYY`). This is an area statistic, not a rate or an individual property bill. Unsupported, missing and censored estimates are null.
|
|
@@ -269,7 +257,7 @@ property_tax = (place.get("deep") or {}).get("property_tax")
|
|
|
269
257
|
|
|
270
258
|
Read `population` as the source’s count for that place boundary. Keep missing or null values unknown and preserve a known zero. State district lists include each district’s population. Postal nearby and distance detail remains metropolitan associations only. Continent population stays in core.
|
|
271
259
|
|
|
272
|
-
Country deep includes `land_area` and `water_area` in km2, `coastline` in km, and
|
|
260
|
+
Country deep includes `land_area` and `water_area` in km2, `coastline` in km, and `elevation_average` in meters. `lowest_point` and `highest_point` contain a nullable `name` and an `elevation` in metres. Values below sea level are negative. Missing or null values stay unknown, and zero stays zero.
|
|
273
261
|
|
|
274
262
|
Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
|
|
275
263
|
|
|
@@ -296,7 +284,7 @@ Choose enrichment for the question you need answered.
|
|
|
296
284
|
| IP | Richer IP fields included with a paid plan. No separate check meter. |
|
|
297
285
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
298
286
|
| 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,
|
|
287
|
+
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
300
288
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
301
289
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
302
290
|
| Company | The complete product detail bag on paid plans. |
|
|
@@ -45,7 +45,7 @@ Pass `country` when a postal code or national phone number needs disambiguation.
|
|
|
45
45
|
|
|
46
46
|
Results are plain data. Pass a returned code or coordinate to another operation when the task needs it. Check nullable values before composing the next call.
|
|
47
47
|
|
|
48
|
-
Use `parse.postal("28202", country="US", deep=True)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `None` means unknown and `0` means known zero.
|
|
48
|
+
Use `parse.postal("28202", country="US", deep=True)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `None` means unknown and `0` means known zero.
|
|
49
49
|
|
|
50
50
|
## Company directory
|
|
51
51
|
|
|
@@ -134,7 +134,6 @@ parse.point(36.0726, -79.792)
|
|
|
134
134
|
parse.weather(40.7128, -74.006)
|
|
135
135
|
parse.domain("example.com")
|
|
136
136
|
parse.asn("AS13335")
|
|
137
|
-
parse.mac("00:1B:63:84:45:E6")
|
|
138
137
|
parse.mx("example.com")
|
|
139
138
|
parse.dns("example.com")
|
|
140
139
|
parse.dns("_dmarc.example.com", type="TXT")
|
|
@@ -174,9 +173,9 @@ Choose display names for one request:
|
|
|
174
173
|
parse.country("DE", lang="fr")
|
|
175
174
|
```
|
|
176
175
|
|
|
177
|
-
`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.
|
|
178
177
|
|
|
179
|
-
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.
|
|
180
179
|
|
|
181
180
|
## Time
|
|
182
181
|
|
|
@@ -224,21 +223,10 @@ Timezone discovery accepts country, IANA area, exact signed offset, abbreviation
|
|
|
224
223
|
|
|
225
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.
|
|
226
225
|
|
|
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
226
|
## Place statistics and optional detail
|
|
241
227
|
|
|
228
|
+
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym and country codes, continent, region and subregion, currency, calling code, `flag`, language and timezone codes, borders, bloc memberships and `capital: { name, lat, lon }`. Paid Deep adds specialist detail, including population, total area and national statistics. `gdp_usd` and `gdp_per_capita_usd` are current US dollars; `population_growth_percent`, `urban_population_percent` and `internet_users_percent` use a 0–100 percent scale (growth can be negative or exceed 100). GDP per person and these three percentages round once to two decimals in the API response. `elevation_average` is average terrain elevation in meters; `lowest_point.elevation` and `highest_point.elevation` keep their point-specific meaning. Unknown stays null and a known zero stays zero. Country tax references are grouped once as `deep.tax: { name, rate }`; the rate remains a percentage. Read capital from the Core object and read the tax name and rate from the Deep tax object.
|
|
229
|
+
|
|
242
230
|
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).
|
|
243
231
|
|
|
244
232
|
Postal and District paid profiles include `deep.property_tax` where supported. It contains `annual_median`, `currency` and `period`: median annual property tax payable on owner-occupied homes in the statistical area. The amount is adjusted to the final year of the reporting period (`YYYY-YYYY`). This is an area statistic, not a rate or an individual property bill. Unsupported, missing and censored estimates are null.
|
|
@@ -250,7 +238,7 @@ property_tax = (place.get("deep") or {}).get("property_tax")
|
|
|
250
238
|
|
|
251
239
|
Read `population` as the source’s count for that place boundary. Keep missing or null values unknown and preserve a known zero. State district lists include each district’s population. Postal nearby and distance detail remains metropolitan associations only. Continent population stays in core.
|
|
252
240
|
|
|
253
|
-
Country deep includes `land_area` and `water_area` in km2, `coastline` in km, and
|
|
241
|
+
Country deep includes `land_area` and `water_area` in km2, `coastline` in km, and `elevation_average` in meters. `lowest_point` and `highest_point` contain a nullable `name` and an `elevation` in metres. Values below sea level are negative. Missing or null values stay unknown, and zero stays zero.
|
|
254
242
|
|
|
255
243
|
Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
|
|
256
244
|
|
|
@@ -277,7 +265,7 @@ Choose enrichment for the question you need answered.
|
|
|
277
265
|
| IP | Richer IP fields included with a paid plan. No separate check meter. |
|
|
278
266
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
279
267
|
| 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,
|
|
268
|
+
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
281
269
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
282
270
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
283
271
|
| 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.5"
|
|
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.5"
|
|
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
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"country": "AQ",
|
|
3
|
+
"iso3": "ATA",
|
|
4
|
+
"numeric": 10,
|
|
5
|
+
"name": "Antarctica",
|
|
6
|
+
"name_full": "Antarctica",
|
|
7
|
+
"name_local": null,
|
|
8
|
+
"demonym": "Antarctican",
|
|
9
|
+
"continent": "AN",
|
|
10
|
+
"region": "Antarctic",
|
|
11
|
+
"subregion": "Antarctic",
|
|
12
|
+
"currency": null,
|
|
13
|
+
"currency_name": null,
|
|
14
|
+
"currency_symbol": null,
|
|
15
|
+
"calling_code": "+672",
|
|
16
|
+
"flag": "🇦🇶",
|
|
17
|
+
"languages": null,
|
|
18
|
+
"timezones": [
|
|
19
|
+
"Antarctica/Casey",
|
|
20
|
+
"Antarctica/Davis",
|
|
21
|
+
"Antarctica/Mawson",
|
|
22
|
+
"Antarctica/Palmer",
|
|
23
|
+
"Antarctica/Rothera",
|
|
24
|
+
"Antarctica/Troll",
|
|
25
|
+
"Antarctica/Vostok",
|
|
26
|
+
"Asia/Riyadh",
|
|
27
|
+
"Asia/Singapore",
|
|
28
|
+
"Pacific/Auckland",
|
|
29
|
+
"Pacific/Port_Moresby"
|
|
30
|
+
],
|
|
31
|
+
"borders": null,
|
|
32
|
+
"blocs": [],
|
|
33
|
+
"capital": {
|
|
34
|
+
"name": null,
|
|
35
|
+
"lat": null,
|
|
36
|
+
"lon": null
|
|
37
|
+
},
|
|
38
|
+
"deep": {
|
|
39
|
+
"population": 0,
|
|
40
|
+
"gdp_usd": null,
|
|
41
|
+
"gdp_per_capita_usd": null,
|
|
42
|
+
"population_growth_percent": null,
|
|
43
|
+
"urban_population_percent": null,
|
|
44
|
+
"internet_users_percent": null,
|
|
45
|
+
"area": 14000000,
|
|
46
|
+
"land_area": null,
|
|
47
|
+
"water_area": null,
|
|
48
|
+
"coastline": null,
|
|
49
|
+
"lowest_point": null,
|
|
50
|
+
"highest_point": null,
|
|
51
|
+
"elevation_average": null,
|
|
52
|
+
"tld": ".aq",
|
|
53
|
+
"week_start": "monday",
|
|
54
|
+
"units": "metric",
|
|
55
|
+
"driving_side": null,
|
|
56
|
+
"plugs": null,
|
|
57
|
+
"voltage": null,
|
|
58
|
+
"frequency": null,
|
|
59
|
+
"emergency": null,
|
|
60
|
+
"postal_format": null,
|
|
61
|
+
"postal_regex": null,
|
|
62
|
+
"tax": {
|
|
63
|
+
"name": null,
|
|
64
|
+
"rate": null
|
|
65
|
+
},
|
|
66
|
+
"ioc": null,
|
|
67
|
+
"fifa": null,
|
|
68
|
+
"plate": null
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"country": "US",
|
|
3
|
+
"iso3": "USA",
|
|
4
|
+
"numeric": 840,
|
|
5
|
+
"name": "United States",
|
|
6
|
+
"name_full": "United States of America",
|
|
7
|
+
"name_local": null,
|
|
8
|
+
"demonym": "American",
|
|
9
|
+
"continent": "NA",
|
|
10
|
+
"region": "Americas",
|
|
11
|
+
"subregion": "Northern America",
|
|
12
|
+
"currency": "USD",
|
|
13
|
+
"currency_name": "United States Dollar",
|
|
14
|
+
"currency_symbol": "$",
|
|
15
|
+
"calling_code": "+1",
|
|
16
|
+
"flag": "🇺🇸",
|
|
17
|
+
"languages": [
|
|
18
|
+
"en"
|
|
19
|
+
],
|
|
20
|
+
"timezones": [
|
|
21
|
+
"America/Adak",
|
|
22
|
+
"America/Anchorage",
|
|
23
|
+
"America/Boise",
|
|
24
|
+
"America/Chicago",
|
|
25
|
+
"America/Denver",
|
|
26
|
+
"America/Detroit",
|
|
27
|
+
"America/Indiana/Indianapolis",
|
|
28
|
+
"America/Indiana/Knox",
|
|
29
|
+
"America/Indiana/Marengo",
|
|
30
|
+
"America/Indiana/Petersburg",
|
|
31
|
+
"America/Indiana/Tell_City",
|
|
32
|
+
"America/Indiana/Vevay",
|
|
33
|
+
"America/Indiana/Vincennes",
|
|
34
|
+
"America/Indiana/Winamac",
|
|
35
|
+
"America/Juneau",
|
|
36
|
+
"America/Kentucky/Louisville",
|
|
37
|
+
"America/Kentucky/Monticello",
|
|
38
|
+
"America/Los_Angeles",
|
|
39
|
+
"America/Menominee",
|
|
40
|
+
"America/Metlakatla",
|
|
41
|
+
"America/New_York",
|
|
42
|
+
"America/Nome",
|
|
43
|
+
"America/North_Dakota/Beulah",
|
|
44
|
+
"America/North_Dakota/Center",
|
|
45
|
+
"America/North_Dakota/New_Salem",
|
|
46
|
+
"America/Phoenix",
|
|
47
|
+
"America/Sitka",
|
|
48
|
+
"America/Yakutat",
|
|
49
|
+
"Pacific/Honolulu"
|
|
50
|
+
],
|
|
51
|
+
"borders": [
|
|
52
|
+
"CA",
|
|
53
|
+
"MX"
|
|
54
|
+
],
|
|
55
|
+
"blocs": [
|
|
56
|
+
"G7",
|
|
57
|
+
"NATO",
|
|
58
|
+
"OECD"
|
|
59
|
+
],
|
|
60
|
+
"capital": {
|
|
61
|
+
"name": "Washington, D.C.",
|
|
62
|
+
"lat": 38.89,
|
|
63
|
+
"lon": -77.05
|
|
64
|
+
},
|
|
65
|
+
"deep": {
|
|
66
|
+
"population": 340110988,
|
|
67
|
+
"gdp_usd": 30769700000000,
|
|
68
|
+
"gdp_per_capita_usd": 90026.52,
|
|
69
|
+
"population_growth_percent": 0.52,
|
|
70
|
+
"urban_population_percent": 80.19,
|
|
71
|
+
"internet_users_percent": 94.69,
|
|
72
|
+
"area": 9629091,
|
|
73
|
+
"land_area": null,
|
|
74
|
+
"water_area": null,
|
|
75
|
+
"coastline": 19924,
|
|
76
|
+
"lowest_point": {
|
|
77
|
+
"name": "Death Valley",
|
|
78
|
+
"elevation": -86
|
|
79
|
+
},
|
|
80
|
+
"highest_point": {
|
|
81
|
+
"name": "Mount McKinley",
|
|
82
|
+
"elevation": 6190
|
|
83
|
+
},
|
|
84
|
+
"elevation_average": 760,
|
|
85
|
+
"tld": ".us",
|
|
86
|
+
"week_start": "sunday",
|
|
87
|
+
"units": "imperial",
|
|
88
|
+
"driving_side": "right",
|
|
89
|
+
"plugs": [
|
|
90
|
+
"A",
|
|
91
|
+
"B"
|
|
92
|
+
],
|
|
93
|
+
"voltage": 120,
|
|
94
|
+
"frequency": 60,
|
|
95
|
+
"emergency": {
|
|
96
|
+
"police": "911",
|
|
97
|
+
"ambulance": "911",
|
|
98
|
+
"fire": "911"
|
|
99
|
+
},
|
|
100
|
+
"postal_format": "#####",
|
|
101
|
+
"postal_regex": "^(?:(\\d{5})(?:[ \\-](\\d{4}))?)$",
|
|
102
|
+
"tax": {
|
|
103
|
+
"name": null,
|
|
104
|
+
"rate": null
|
|
105
|
+
},
|
|
106
|
+
"ioc": "USA",
|
|
107
|
+
"fifa": "USA",
|
|
108
|
+
"plate": "USA"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"country": "DE",
|
|
3
|
+
"iso3": "DEU",
|
|
4
|
+
"numeric": 276,
|
|
5
|
+
"name": "Germany",
|
|
6
|
+
"name_full": "Federal Republic of Germany",
|
|
7
|
+
"name_local": "Deutschland",
|
|
8
|
+
"demonym": "German",
|
|
9
|
+
"continent": "EU",
|
|
10
|
+
"region": "Europe",
|
|
11
|
+
"subregion": "Western Europe",
|
|
12
|
+
"currency": "EUR",
|
|
13
|
+
"currency_name": "Euro",
|
|
14
|
+
"currency_symbol": "€",
|
|
15
|
+
"calling_code": "+49",
|
|
16
|
+
"flag": "🇩🇪",
|
|
17
|
+
"languages": [
|
|
18
|
+
"de"
|
|
19
|
+
],
|
|
20
|
+
"timezones": [
|
|
21
|
+
"Europe/Berlin",
|
|
22
|
+
"Europe/Zurich"
|
|
23
|
+
],
|
|
24
|
+
"borders": [
|
|
25
|
+
"AT",
|
|
26
|
+
"BE",
|
|
27
|
+
"CH",
|
|
28
|
+
"CZ",
|
|
29
|
+
"DK",
|
|
30
|
+
"FR",
|
|
31
|
+
"LU",
|
|
32
|
+
"NL",
|
|
33
|
+
"PL"
|
|
34
|
+
],
|
|
35
|
+
"blocs": [
|
|
36
|
+
"EEA",
|
|
37
|
+
"EU",
|
|
38
|
+
"EUROZONE",
|
|
39
|
+
"G7",
|
|
40
|
+
"NATO",
|
|
41
|
+
"OECD",
|
|
42
|
+
"SCHENGEN",
|
|
43
|
+
"SEPA"
|
|
44
|
+
],
|
|
45
|
+
"capital": {
|
|
46
|
+
"name": "Berlin",
|
|
47
|
+
"lat": 52.52,
|
|
48
|
+
"lon": 13.4
|
|
49
|
+
},
|
|
50
|
+
"deep": {
|
|
51
|
+
"population": 83516593,
|
|
52
|
+
"gdp_usd": 5050922925047.05,
|
|
53
|
+
"gdp_per_capita_usd": 60496.44,
|
|
54
|
+
"population_growth_percent": -0.03,
|
|
55
|
+
"urban_population_percent": 82.14,
|
|
56
|
+
"internet_users_percent": 93.5,
|
|
57
|
+
"area": 357021,
|
|
58
|
+
"land_area": null,
|
|
59
|
+
"water_area": null,
|
|
60
|
+
"coastline": 2389,
|
|
61
|
+
"lowest_point": {
|
|
62
|
+
"name": "Neuendorf bei Wilster",
|
|
63
|
+
"elevation": -3.5
|
|
64
|
+
},
|
|
65
|
+
"highest_point": {
|
|
66
|
+
"name": "Zugspitze",
|
|
67
|
+
"elevation": 2963
|
|
68
|
+
},
|
|
69
|
+
"elevation_average": 263,
|
|
70
|
+
"tld": ".de",
|
|
71
|
+
"week_start": "monday",
|
|
72
|
+
"units": "metric",
|
|
73
|
+
"driving_side": "right",
|
|
74
|
+
"plugs": [
|
|
75
|
+
"C",
|
|
76
|
+
"F"
|
|
77
|
+
],
|
|
78
|
+
"voltage": 230,
|
|
79
|
+
"frequency": 50,
|
|
80
|
+
"emergency": {
|
|
81
|
+
"police": "110",
|
|
82
|
+
"ambulance": "112",
|
|
83
|
+
"fire": "112"
|
|
84
|
+
},
|
|
85
|
+
"postal_format": "#####",
|
|
86
|
+
"postal_regex": "^(?:\\d{5})$",
|
|
87
|
+
"tax": {
|
|
88
|
+
"name": "VAT",
|
|
89
|
+
"rate": 19
|
|
90
|
+
},
|
|
91
|
+
"ioc": "GER",
|
|
92
|
+
"fifa": "GER",
|
|
93
|
+
"plate": "D"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -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])
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import asyncio,json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import httpx
|
|
4
|
+
from parseapi import ParseAPI,AsyncParseAPI
|
|
5
|
+
|
|
6
|
+
FULL=json.loads((Path(__file__).parent/'fixtures/country-corrected.json').read_text())
|
|
7
|
+
|
|
8
|
+
def test_country_core_context_and_detail_preserved_in_sync_and_async():
|
|
9
|
+
calls=[]
|
|
10
|
+
def transport(request):
|
|
11
|
+
calls.append(request)
|
|
12
|
+
return httpx.Response(200,json=FULL)
|
|
13
|
+
with ParseAPI('fixture',transport=httpx.MockTransport(transport)) as client:
|
|
14
|
+
assert client.country('US',deep=True)==FULL
|
|
15
|
+
async def check():
|
|
16
|
+
async with AsyncParseAPI('fixture',transport=httpx.MockTransport(transport)) as client:
|
|
17
|
+
assert await client.country('US',deep=True)==FULL
|
|
18
|
+
asyncio.run(check())
|
|
19
|
+
assert len(calls)==2
|
|
20
|
+
assert FULL['name_full']=='United States of America' and 'full_name' not in FULL
|
|
21
|
+
assert 'population' not in FULL and 'area' not in FULL
|
|
22
|
+
assert FULL['demonym']=='American'
|
|
23
|
+
assert FULL['flag']=='🇺🇸' and 'emoji' not in FULL
|
|
24
|
+
assert FULL['capital']=={'name':'Washington, D.C.','lat':38.89,'lon':-77.05}
|
|
25
|
+
assert FULL['deep']['tax']=={'name':None,'rate':None}
|
|
26
|
+
assert not {'capital_lat','capital_lon'}&FULL.keys()
|
|
27
|
+
assert not {'tax_rate','tax_id_format','tax_id_regex'}&FULL['deep'].keys()
|
|
28
|
+
assert FULL['region']=='Americas' and FULL['subregion']=='Northern America'
|
|
29
|
+
assert FULL['deep']['elevation_average']==760
|
|
30
|
+
assert FULL['deep']['gdp_per_capita_usd']==90026.52
|
|
31
|
+
assert not set(['iso3','numeric','name_full','full_name','demonym','region','subregion','capital','capital_lat','capital_lon','borders','blocs'])&FULL['deep'].keys()
|
|
32
|
+
|
|
33
|
+
def test_actual_antarctica_nulls_stay_null():
|
|
34
|
+
aq=json.loads((Path(__file__).parent/'fixtures/country-aq.json').read_text())
|
|
35
|
+
with ParseAPI('fixture',transport=httpx.MockTransport(lambda _:httpx.Response(200,json=aq))) as client:
|
|
36
|
+
value=client.country('AQ',deep=True)
|
|
37
|
+
assert value==aq and value['languages'] is None and value['deep']['population']==0
|
|
38
|
+
assert [value[k] for k in ('currency','currency_name','currency_symbol')]==[None,None,None]
|
|
39
|
+
|
|
40
|
+
def test_country_tax_reference_zeroes_and_deep_modes():
|
|
41
|
+
de=json.loads((Path(__file__).parent/'fixtures/country-de.json').read_text())
|
|
42
|
+
zero={**de,'capital':{'name':None,'lat':0,'lon':0},'deep':{**de['deep'],'tax':{'name':None,'rate':0}}}
|
|
43
|
+
core={k:v for k,v in FULL.items() if k!='deep'}
|
|
44
|
+
bodies=[de,zero,core,{**core,'deep':{}}];calls=[]
|
|
45
|
+
def transport(request):
|
|
46
|
+
calls.append(request);return httpx.Response(200,json=bodies.pop(0))
|
|
47
|
+
with ParseAPI('fixture',transport=httpx.MockTransport(transport)) as client:
|
|
48
|
+
assert client.country('DE',deep=True)==de
|
|
49
|
+
assert de['deep']['tax']=={'name':'VAT','rate':19}
|
|
50
|
+
assert client.country('DE',deep=True)==zero
|
|
51
|
+
assert client.country('US')==core
|
|
52
|
+
assert client.country('US',deep=True)=={**core,'deep':{}}
|
|
53
|
+
assert len(calls)==4
|
|
@@ -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.5}/tests/fixtures/response-fixtures/clean-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/clean-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/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.5}/tests/fixtures/response-fixtures/standard-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/tests/fixtures/response-fixtures/standard-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.3 → parseapi-1.10.5}/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.5}/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
|