parseapi 1.10.5__tar.gz → 1.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {parseapi-1.10.5 → parseapi-1.11.0}/PKG-INFO +15 -5
- {parseapi-1.10.5 → parseapi-1.11.0}/README.md +14 -4
- {parseapi-1.10.5 → parseapi-1.11.0}/pyproject.toml +1 -1
- {parseapi-1.10.5 → parseapi-1.11.0}/smoke/smoke.py +1 -1
- {parseapi-1.10.5 → parseapi-1.11.0}/src/parseapi/__init__.py +1 -1
- {parseapi-1.10.5 → parseapi-1.11.0}/src/parseapi/_client.py +33 -3
- parseapi-1.11.0/tests/fixtures/iso-contract.json +93 -0
- parseapi-1.11.0/tests/test_iso_contract.py +40 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/.github/workflows/publish.yml +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/.github/workflows/test.yml +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/.gitignore +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/CHANGELOG.md +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/LICENSE +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/api/public.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/scripts/public_api.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/src/parseapi/city.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/src/parseapi/py.typed +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/country-aq.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/country-corrected.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/country-de.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/emoji-artwork.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/emoji-catalog.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/measure-response.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-company-coverage.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-company-profile.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-emoji-catalog.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-emoji-metadata.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-provider.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-tariff-search.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-tariff.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-time.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-timezones.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-company-coverage.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-company-profile.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-emoji-catalog.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-emoji-metadata.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-provider.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-tariff-search.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-tariff.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-time.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-timezones.json +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_card_dx.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_city_canonical.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_city_quality.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_city_query_parity.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_client.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_company_directory.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_country_corrected.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_email_enrichment.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_emoji.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_language.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_name_formatting.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_postal_localities.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_public_api.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_response_decoding.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_stack.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_time_complete.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_time_gaps.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/test_version.py +0 -0
- {parseapi-1.10.5 → parseapi-1.11.0}/tests/typing_company_directory.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: parseapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.0
|
|
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
|
|
@@ -96,6 +96,15 @@ Discovery example: `parse.company.search(country="US", industry="0700", industry
|
|
|
96
96
|
Supply `industry` and `industry_type` together. The supported namespace is `sic`, with an exact four-digit string such as `0700`; leading zeros are meaningful. Country-only discovery is also supported. Filters intersect and may narrow an existing selector. Country matches the profile country, not a headquarters or operating-presence claim. Unknown values do not match a requested filter. Filter-only candidates use `match.field: "filters"` and `match.value: null`; reuse the same filters and limit with a returned cursor. Counts describe this directory edition, not complete country coverage.
|
|
97
97
|
|
|
98
98
|
|
|
99
|
+
## ISO identifiers
|
|
100
|
+
|
|
101
|
+
Country uses `iso_alpha3` and `iso_numeric`, State uses the full
|
|
102
|
+
`iso_subdivision` code such as `US-CA`, Language uses `iso_alpha3`, and Currency
|
|
103
|
+
uses `iso_numeric`. Primary `country`, `state`, `language` and `currency` codes
|
|
104
|
+
keep their meaning. Results retain the selected API contract's exact keys,
|
|
105
|
+
values, nulls and nesting. Earlier server contracts retain their earlier ISO
|
|
106
|
+
spellings. Use the existing lookup methods for each resource.
|
|
107
|
+
|
|
99
108
|
## Calls
|
|
100
109
|
|
|
101
110
|
One method per endpoint, named after the route.
|
|
@@ -192,7 +201,7 @@ Choose display names for one request:
|
|
|
192
201
|
parse.country("DE", lang="fr")
|
|
193
202
|
```
|
|
194
203
|
|
|
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.
|
|
204
|
+
`lang` is optional on geography lookups and their lists/searches, Currency lookup, 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.
|
|
196
205
|
|
|
197
206
|
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.
|
|
198
207
|
|
|
@@ -244,7 +253,7 @@ Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offse
|
|
|
244
253
|
|
|
245
254
|
## Place statistics and optional detail
|
|
246
255
|
|
|
247
|
-
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym and country
|
|
256
|
+
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym, `iso_alpha3` and `iso_numeric` country identifiers, 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
257
|
|
|
249
258
|
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).
|
|
250
259
|
|
|
@@ -285,6 +294,7 @@ Choose enrichment for the question you need answered.
|
|
|
285
294
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
286
295
|
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
|
|
287
296
|
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
297
|
+
| Currency | Currency metadata on paid plans; lookup and exchange-rate conversion use pooled requests. |
|
|
288
298
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
289
299
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
290
300
|
| Company | The complete product detail bag on paid plans. |
|
|
@@ -383,9 +393,9 @@ result = parse.stack("example.com")
|
|
|
383
393
|
# AsyncParseAPI exposes the same calls with await.
|
|
384
394
|
```
|
|
385
395
|
|
|
386
|
-
|
|
396
|
+
Stack checks static homepage HTML and response headers. It returns the checked URL, original `checked_at` time and eight technology arrays.
|
|
387
397
|
|
|
388
|
-
`cms`, `servers`, `frameworks`, `ecommerce`, `analytics`, `chat`, `payments` and `hosting` are arrays because a site can use several technologies in each category. Each entry contains `technology`, `name` and nullable `version`. Technology codes are open strings. A successful check uses empty arrays for categories with no matches. When no HTML page could be checked, `checked_at` and all categories are null
|
|
398
|
+
`cms`, `servers`, `frameworks`, `ecommerce`, `analytics`, `chat`, `payments` and `hosting` are arrays because a site can use several technologies in each category. Each entry contains `technology`, `name` and nullable `version`. Technology codes are open strings. A successful check uses empty arrays for categories with no matches. When no HTML page could be checked, `checked_at` and all categories are null. Unknown or conflicting versions are null. Detections describe the checked homepage.
|
|
389
399
|
|
|
390
400
|
Successful checks may be reused for up to 24 hours. `pretty` optionally formats the wire JSON. Stack uses your plan's request allowance and API version 2.0.0 selected by this client.
|
|
391
401
|
|
|
@@ -77,6 +77,15 @@ Discovery example: `parse.company.search(country="US", industry="0700", industry
|
|
|
77
77
|
Supply `industry` and `industry_type` together. The supported namespace is `sic`, with an exact four-digit string such as `0700`; leading zeros are meaningful. Country-only discovery is also supported. Filters intersect and may narrow an existing selector. Country matches the profile country, not a headquarters or operating-presence claim. Unknown values do not match a requested filter. Filter-only candidates use `match.field: "filters"` and `match.value: null`; reuse the same filters and limit with a returned cursor. Counts describe this directory edition, not complete country coverage.
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
## ISO identifiers
|
|
81
|
+
|
|
82
|
+
Country uses `iso_alpha3` and `iso_numeric`, State uses the full
|
|
83
|
+
`iso_subdivision` code such as `US-CA`, Language uses `iso_alpha3`, and Currency
|
|
84
|
+
uses `iso_numeric`. Primary `country`, `state`, `language` and `currency` codes
|
|
85
|
+
keep their meaning. Results retain the selected API contract's exact keys,
|
|
86
|
+
values, nulls and nesting. Earlier server contracts retain their earlier ISO
|
|
87
|
+
spellings. Use the existing lookup methods for each resource.
|
|
88
|
+
|
|
80
89
|
## Calls
|
|
81
90
|
|
|
82
91
|
One method per endpoint, named after the route.
|
|
@@ -173,7 +182,7 @@ Choose display names for one request:
|
|
|
173
182
|
parse.country("DE", lang="fr")
|
|
174
183
|
```
|
|
175
184
|
|
|
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.
|
|
185
|
+
`lang` is optional on geography lookups and their lists/searches, Currency lookup, 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.
|
|
177
186
|
|
|
178
187
|
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.
|
|
179
188
|
|
|
@@ -225,7 +234,7 @@ Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offse
|
|
|
225
234
|
|
|
226
235
|
## Place statistics and optional detail
|
|
227
236
|
|
|
228
|
-
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym and country
|
|
237
|
+
Country Core contains the everyday reference: `name`, `name_full`, `name_local`, demonym, `iso_alpha3` and `iso_numeric` country identifiers, 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
238
|
|
|
230
239
|
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).
|
|
231
240
|
|
|
@@ -266,6 +275,7 @@ Choose enrichment for the question you need answered.
|
|
|
266
275
|
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
267
276
|
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
|
|
268
277
|
| Phone, Time, Date, Language, Emoji, Point | Optional detail in the same pooled request on every plan. |
|
|
278
|
+
| Currency | Currency metadata on paid plans; lookup and exchange-rate conversion use pooled requests. |
|
|
269
279
|
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
270
280
|
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
|
|
271
281
|
| Company | The complete product detail bag on paid plans. |
|
|
@@ -364,9 +374,9 @@ result = parse.stack("example.com")
|
|
|
364
374
|
# AsyncParseAPI exposes the same calls with await.
|
|
365
375
|
```
|
|
366
376
|
|
|
367
|
-
|
|
377
|
+
Stack checks static homepage HTML and response headers. It returns the checked URL, original `checked_at` time and eight technology arrays.
|
|
368
378
|
|
|
369
|
-
`cms`, `servers`, `frameworks`, `ecommerce`, `analytics`, `chat`, `payments` and `hosting` are arrays because a site can use several technologies in each category. Each entry contains `technology`, `name` and nullable `version`. Technology codes are open strings. A successful check uses empty arrays for categories with no matches. When no HTML page could be checked, `checked_at` and all categories are null
|
|
379
|
+
`cms`, `servers`, `frameworks`, `ecommerce`, `analytics`, `chat`, `payments` and `hosting` are arrays because a site can use several technologies in each category. Each entry contains `technology`, `name` and nullable `version`. Technology codes are open strings. A successful check uses empty arrays for categories with no matches. When no HTML page could be checked, `checked_at` and all categories are null. Unknown or conflicting versions are null. Detections describe the checked homepage.
|
|
370
380
|
|
|
371
381
|
Successful checks may be reused for up to 24 hours. `pretty` optionally formats the wire JSON. Stack uses your plan's request allowance and API version 2.0.0 selected by this client.
|
|
372
382
|
|
|
@@ -51,7 +51,7 @@ expect_ok("ip", lambda: parse.ip("8.8.8.8"), lambda r: None if r["ip"] == "8.8.8
|
|
|
51
51
|
expect_ok("ip.self", lambda: parse.ip.self(), lambda r: None if r.get("ip") else "no ip")
|
|
52
52
|
expect_ok("continent", lambda: parse.continent("NA"), lambda r: None if r["name"] == "North America" else "wrong name")
|
|
53
53
|
expect_ok("continent.countries", lambda: parse.continent.countries("NA"), lambda r: None if r["countries"] else "empty")
|
|
54
|
-
expect_ok("country", lambda: parse.country("US"), lambda r: None if r
|
|
54
|
+
expect_ok("country", lambda: parse.country("US"), lambda r: None if r.get("iso_alpha3", r.get("iso3")) == "USA" else "wrong country alpha-3 code")
|
|
55
55
|
expect_ok("country.states", lambda: parse.country.states("US"), lambda r: None if len(r["states"]) >= 50 else "too few")
|
|
56
56
|
expect_ok("state", lambda: parse.state("NC", country="US"), lambda r: None if r["name"] == "North Carolina" else "wrong")
|
|
57
57
|
expect_ok("state.districts", lambda: parse.state.districts("NC", country="US"), lambda r: None if r["districts"] else "empty")
|
|
@@ -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.6"
|
|
17
17
|
_API_VERSION = "2.0.0"
|
|
18
18
|
DEFAULT_BASE_URL = "https://api.parseapi.com"
|
|
19
19
|
DEFAULT_TIMEOUT = 10.0
|
|
@@ -307,7 +307,7 @@ class ParseAPI:
|
|
|
307
307
|
def stack(self, domain: str, *, deep: bool = False, pretty: bool = False) -> Json:
|
|
308
308
|
"""Identify website technologies and versions by category.
|
|
309
309
|
|
|
310
|
-
|
|
310
|
+
Categories are arrays or null.
|
|
311
311
|
Lists are null when no page could be checked and empty for no matches.
|
|
312
312
|
Pass a hostname without a URL scheme or path.
|
|
313
313
|
"""
|
|
@@ -749,7 +749,7 @@ class AsyncParseAPI:
|
|
|
749
749
|
async def stack(self, domain: str, *, deep: bool = False, pretty: bool = False) -> Json:
|
|
750
750
|
"""Identify website technologies and versions by category.
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
Categories are arrays or null.
|
|
753
753
|
Lists are null when no page could be checked and empty for no matches.
|
|
754
754
|
Pass a hostname without a URL scheme or path.
|
|
755
755
|
"""
|
|
@@ -1276,3 +1276,33 @@ def _time_targets(targets: Optional[list[str]], to: Optional[str]) -> Optional[s
|
|
|
1276
1276
|
|
|
1277
1277
|
def _city_csv(value: Optional[Union[str, Sequence[str]]]) -> Optional[str]:
|
|
1278
1278
|
return value if isinstance(value, str) or value is None else ",".join(value)
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
class _CurrencySync:
|
|
1282
|
+
def __init__(self, client: ParseAPI):
|
|
1283
|
+
self._client = client
|
|
1284
|
+
|
|
1285
|
+
def __call__(self, code: str, *, deep: bool = False, lang: Optional[str] = None) -> Json:
|
|
1286
|
+
return self._client._get(f"/currency/{_seg(code)}", {"deep": deep, "lang": lang})
|
|
1287
|
+
|
|
1288
|
+
def rate(
|
|
1289
|
+
self, base: str, quote_currency: str, *, date: Optional[str] = None, amount: Optional[float] = None
|
|
1290
|
+
) -> Json:
|
|
1291
|
+
return self._client._get(
|
|
1292
|
+
f"/currency/{_seg(base)}/{_seg(quote_currency)}", {"date": date, "amount": amount}
|
|
1293
|
+
)
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
class _CurrencyAsync:
|
|
1297
|
+
def __init__(self, client: AsyncParseAPI):
|
|
1298
|
+
self._client = client
|
|
1299
|
+
|
|
1300
|
+
async def __call__(self, code: str, *, deep: bool = False, lang: Optional[str] = None) -> Json:
|
|
1301
|
+
return await self._client._get(f"/currency/{_seg(code)}", {"deep": deep, "lang": lang})
|
|
1302
|
+
|
|
1303
|
+
async def rate(
|
|
1304
|
+
self, base: str, quote_currency: str, *, date: Optional[str] = None, amount: Optional[float] = None
|
|
1305
|
+
) -> Json:
|
|
1306
|
+
return await self._client._get(
|
|
1307
|
+
f"/currency/{_seg(base)}/{_seg(quote_currency)}", {"date": date, "amount": amount}
|
|
1308
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"operation": "country",
|
|
4
|
+
"code": "US",
|
|
5
|
+
"deep": false,
|
|
6
|
+
"body": {
|
|
7
|
+
"country": "US",
|
|
8
|
+
"iso3": "USA",
|
|
9
|
+
"numeric": 840
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"operation": "country",
|
|
14
|
+
"code": "US",
|
|
15
|
+
"deep": false,
|
|
16
|
+
"body": {
|
|
17
|
+
"country": "US",
|
|
18
|
+
"iso_alpha3": "USA",
|
|
19
|
+
"iso_numeric": 840
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"operation": "country",
|
|
24
|
+
"code": "AQ",
|
|
25
|
+
"deep": false,
|
|
26
|
+
"body": {
|
|
27
|
+
"country": "AQ",
|
|
28
|
+
"iso_alpha3": "ATA",
|
|
29
|
+
"iso_numeric": 10
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"operation": "state",
|
|
34
|
+
"code": "CA",
|
|
35
|
+
"country": "US",
|
|
36
|
+
"deep": true,
|
|
37
|
+
"body": {
|
|
38
|
+
"state": "CA",
|
|
39
|
+
"country": "US",
|
|
40
|
+
"deep": {
|
|
41
|
+
"iso_3166_2": "US-CA"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"operation": "state",
|
|
47
|
+
"code": "CA",
|
|
48
|
+
"country": "US",
|
|
49
|
+
"deep": false,
|
|
50
|
+
"body": {
|
|
51
|
+
"state": "CA",
|
|
52
|
+
"country": "US",
|
|
53
|
+
"iso_subdivision": "US-CA"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"operation": "language",
|
|
58
|
+
"code": "hr",
|
|
59
|
+
"deep": true,
|
|
60
|
+
"body": {
|
|
61
|
+
"language": "hr",
|
|
62
|
+
"deep": {
|
|
63
|
+
"iso3": "hrv",
|
|
64
|
+
"countries": [
|
|
65
|
+
"BA",
|
|
66
|
+
"HR"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"operation": "language",
|
|
73
|
+
"code": "hr",
|
|
74
|
+
"deep": false,
|
|
75
|
+
"body": {
|
|
76
|
+
"language": "hr",
|
|
77
|
+
"iso_alpha3": "hrv",
|
|
78
|
+
"countries": [
|
|
79
|
+
"BA",
|
|
80
|
+
"HR"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"operation": "language",
|
|
86
|
+
"code": "gsw",
|
|
87
|
+
"deep": false,
|
|
88
|
+
"body": {
|
|
89
|
+
"language": "gsw",
|
|
90
|
+
"iso_alpha3": "gsw"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from parseapi import ParseAPI, AsyncParseAPI
|
|
7
|
+
|
|
8
|
+
CASES = json.loads((Path(__file__).parent / "fixtures/iso-contract.json").read_text())
|
|
9
|
+
|
|
10
|
+
def options(sample):
|
|
11
|
+
return {"deep": sample["deep"], **({"country": sample["country"]} if "country" in sample else {})}
|
|
12
|
+
|
|
13
|
+
def test_iso_contracts_remain_raw_through_existing_sync_transport():
|
|
14
|
+
for sample in CASES:
|
|
15
|
+
calls = []
|
|
16
|
+
def transport(request):
|
|
17
|
+
calls.append(request)
|
|
18
|
+
return httpx.Response(200, json=sample["body"])
|
|
19
|
+
with ParseAPI("fixture", transport=httpx.MockTransport(transport)) as client:
|
|
20
|
+
operation = getattr(client, sample["operation"])
|
|
21
|
+
result = operation(sample["code"], **options(sample))
|
|
22
|
+
assert result == sample["body"]
|
|
23
|
+
assert len(calls) == 1
|
|
24
|
+
assert calls[0].url.path == f"/{sample['operation']}/{sample['code']}"
|
|
25
|
+
assert calls[0].url.params.get("deep") == ("true" if sample["deep"] else None)
|
|
26
|
+
|
|
27
|
+
def test_iso_contracts_remain_raw_through_existing_async_transport():
|
|
28
|
+
async def run():
|
|
29
|
+
for sample in CASES:
|
|
30
|
+
calls = []
|
|
31
|
+
def transport(request):
|
|
32
|
+
calls.append(request)
|
|
33
|
+
return httpx.Response(200, json=sample["body"])
|
|
34
|
+
async with AsyncParseAPI("fixture", transport=httpx.MockTransport(transport)) as client:
|
|
35
|
+
operation = getattr(client, sample["operation"])
|
|
36
|
+
result = await operation(sample["code"], **options(sample))
|
|
37
|
+
assert result == sample["body"]
|
|
38
|
+
assert len(calls) == 1
|
|
39
|
+
asyncio.run(run())
|
|
40
|
+
|
|
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
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/clean-tariff-search.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-company-coverage.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-company-profile.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-emoji-catalog.json
RENAMED
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-emoji-metadata.json
RENAMED
|
File without changes
|
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/tests/fixtures/response-fixtures/standard-tariff-search.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parseapi-1.10.5 → parseapi-1.11.0}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|