Code Monkey home page Code Monkey logo

namsor-python-sdk2's Introduction

openapi-client

NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. By default, enpoints use 1 unit per name (ex. Gender), but Ethnicity classification uses 10 to 20 units per name depending on taxonomy. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it!

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.27
  • Package version: 2.0.27
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit http://www.namsor.com/

Requirements.

Python >=3.7

Migration from other generators like python and python-legacy

Changes

  1. This generator uses spec case for all (object) property names and parameter names.
    • So if the spec has a property name like camelCase, it will use camelCase rather than camel_case
    • So you will need to update how you input and read properties to use spec case
  2. Endpoint parameters are stored in dictionaries to prevent collisions (explanation below)
    • So you will need to update how you pass data in to endpoints
  3. Endpoint responses now include the original response, the deserialized response body, and (todo)the deserialized headers
    • So you will need to update your code to use response.body to access deserialized data
  4. All validated data is instantiated in an instance that subclasses all validated Schema classes and Decimal/str/list/tuple/frozendict/NoneClass/BoolClass/bytes/io.FileIO
    • This means that you can use isinstance to check if a payload validated against a schema class
    • This means that no data will be of type None/True/False
      • ingested None will subclass NoneClass
      • ingested True will subclass BoolClass
      • ingested False will subclass BoolClass
      • So if you need to check is True/False/None, instead use instance.is_true_oapg()/.is_false_oapg()/.is_none_oapg()
  5. All validated class instances are immutable except for ones based on io.File
    • This is because if properties were changed after validation, that validation would no longer apply
    • So no changing values or property values after a class has been instantiated
  6. String + Number types with formats
    • String type data is stored as a string and if you need to access types based on its format like date, date-time, uuid, number etc then you will need to use accessor functions on the instance
    • type string + format: See .as_date_oapg, .as_datetime_oapg, .as_decimal_oapg, .as_uuid_oapg
    • type number + format: See .as_float_oapg, .as_int_oapg
    • this was done because openapi/json-schema defines constraints. string data may be type string with no format keyword in one schema, and include a format constraint in another schema
    • So if you need to access a string format based type, use as_date_oapg/as_datetime_oapg/as_decimal_oapg/as_uuid_oapg
    • So if you need to access a number format based type, use as_int_oapg/as_float_oapg
  7. Property access on AnyType(type unset) or object(dict) schemas
    • Only required keys with valid python names are properties like .someProp and have type hints
    • All optional keys may not exist, so properties are not defined for them
    • One can access optional values with dict_instance['optionalProp'] and KeyError will be raised if it does not exist
    • Use get_item_oapg if you need a way to always get a value whether or not the key exists
      • If the key does not exist, schemas.unset is returned from calling dict_instance.get_item_oapg('optionalProp')
      • All required and optional keys have type hints for this method, and @typing.overload is used
      • A type hint is also generated for additionalProperties accessed using this method
    • So you will need to update you code to use some_instance['optionalProp'] to access optional property and additionalProperty values
  8. The location of the api classes has changed
    • Api classes are located in your_package.apis.tags.some_api
    • This change was made to eliminate redundant code generation
    • Legacy generators generated the same endpoint twice if it had > 1 tag on it
    • This generator defines an endpoint in one class, then inherits that class to generate apis by tags and by paths
    • This change reduces code and allows quicker run time if you use the path apis
      • path apis are at your_package.apis.paths.some_path
    • Those apis will only load their needed models, which is less to load than all of the resources needed in a tag api
    • So you will need to update your import paths to the api classes

Why are Oapg and _oapg used in class and method names?

Classes can have arbitrarily named properties set on them Endpoints can have arbitrary operationId method names set For those reasons, I use the prefix Oapg and _oapg to greatly reduce the likelihood of collisions on protected + public classes/methods. oapg stands for OpenApi Python Generator.

Object property spec case

This was done because when payloads are ingested, they can be validated against N number of schemas. If the input signature used a different property name then that has mutated the payload. So SchemaA and SchemaB must both see the camelCase spec named variable. Also it is possible to send in two properties, named camelCase and camel_case in the same payload. That use case should be support so spec case is used.

Parameter spec case

Parameters can be included in different locations including:

  • query
  • path
  • header
  • cookie

Any of those parameters could use the same parameter names, so if every parameter was included as an endpoint parameter in a function signature, they would collide. For that reason, each of those inputs have been separated out into separate typed dictionaries:

  • query_params
  • path_params
  • header_params
  • cookie_params

So when updating your code, you will need to pass endpoint parameters in using those dictionaries.

Endpoint responses

Endpoint responses have been enriched to now include more information. Any response reom an endpoint will now include the following properties: response: urllib3.HTTPResponse body: typing.Union[Unset, Schema] headers: typing.Union[Unset, TODO] Note: response header deserialization has not yet been added

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/namsor/namsor-python-sdk2.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/namsor/namsor-python-sdk2.git)

Then import the package:

import openapi_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import openapi_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import openapi_client
from pprint import pprint
from openapi_client.apis.tags import admin_api
from openapi_client.model.api_classifier_taxonomy_out import APIClassifierTaxonomyOut
from openapi_client.model.api_classifiers_status_out import APIClassifiersStatusOut
from openapi_client.model.api_key_out import APIKeyOut
from openapi_client.model.api_period_usage_out import APIPeriodUsageOut
from openapi_client.model.api_services_out import APIServicesOut
from openapi_client.model.api_usage_aggregated_out import APIUsageAggregatedOut
from openapi_client.model.api_usage_history_out import APIUsageHistoryOut
from openapi_client.model.region_out import RegionOut
from openapi_client.model.software_version_out import SoftwareVersionOut
# Defining the host is optional and defaults to https://v2.namsor.com/NamSorAPIv2
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
    host = "https://v2.namsor.com/NamSorAPIv2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: api_key
configuration.api_key['api_key'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'

# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin_api.AdminApi(api_client)
    source = "source_example" # str | 
anonymized = True # bool | 
token = "token_example" # str | 

    try:
        # Activate/deactivate anonymization for a source.
        api_response = api_instance.anonymize(sourceanonymizedtoken)
        pprint(api_response)
    except openapi_client.ApiException as e:
        print("Exception when calling AdminApi->anonymize: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://v2.namsor.com/NamSorAPIv2

Class Method HTTP request Description
AdminApi anonymize get /api2/json/anonymize/{source}/{anonymized}/{token} Activate/deactivate anonymization for a source.
AdminApi anonymize1 get /api2/json/anonymize/{source}/{anonymized} Activate/deactivate anonymization for a source.
AdminApi api_key_info get /api2/json/apiKeyInfo Read API Key info.
AdminApi api_status get /api2/json/apiStatus Prints the current status of the classifiers. A classifier name in apiStatus corresponds to a service name in apiServices.
AdminApi api_usage get /api2/json/apiUsage Print current API usage.
AdminApi api_usage_history get /api2/json/apiUsageHistory Print historical API usage.
AdminApi api_usage_history_aggregate get /api2/json/apiUsageHistoryAggregate Print historical API usage (in an aggregated view, by service, by day/hour/min).
AdminApi available_services get /api2/json/apiServices List of classification services and usage cost in Units per classification (default is 1=ONE Unit). Some API endpoints (ex. Corridor) combine multiple classifiers.
AdminApi disable get /api2/json/disable/{source}/{disabled} Activate/deactivate an API Key.
AdminApi learnable get /api2/json/learnable/{source}/{learnable}/{token} Activate/deactivate learning from a source.
AdminApi learnable1 get /api2/json/learnable/{source}/{learnable} Activate/deactivate learning from a source.
AdminApi regions get /api2/json/regions Print basic source statistics.
AdminApi software_version get /api2/json/softwareVersion Get the current software version
AdminApi taxonomy_classes get /api2/json/taxonomyClasses/{classifierName} Print the taxonomy classes valid for the given classifier.
ChineseApi chinese_name_candidates get /api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin} Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
ChineseApi chinese_name_candidates_batch post /api2/json/chineseNameCandidatesBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApi chinese_name_candidates_gender_batch post /api2/json/chineseNameCandidatesGenderBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
ChineseApi chinese_name_gender_candidates get /api2/json/chineseNameGenderCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}/{knownGender} Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female')
ChineseApi chinese_name_match get /api2/json/chineseNameMatch/{chineseSurnameLatin}/{chineseGivenNameLatin}/{chineseName} Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
ChineseApi chinese_name_match_batch post /api2/json/chineseNameMatchBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApi gender_chinese_name get /api2/json/genderChineseName/{chineseName} Infer the likely gender of a Chinese full name ex. 王晓明
ChineseApi gender_chinese_name_batch post /api2/json/genderChineseNameBatch Infer the likely gender of up to 100 full names ex. 王晓明
ChineseApi gender_chinese_name_pinyin get /api2/json/genderChineseNamePinyin/{chineseSurnameLatin}/{chineseGivenNameLatin} Infer the likely gender of a Chinese name in LATIN (Pinyin).
ChineseApi gender_chinese_name_pinyin_batch post /api2/json/genderChineseNamePinyinBatch Infer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
ChineseApi parse_chinese_name get /api2/json/parseChineseName/{chineseName} Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name)
ChineseApi parse_chinese_name_batch post /api2/json/parseChineseNameBatch Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name).
ChineseApi pinyin_chinese_name get /api2/json/pinyinChineseName/{chineseName} Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name)
ChineseApi pinyin_chinese_name_batch post /api2/json/pinyinChineseNameBatch Romanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name).
GeneralApi name_type get /api2/json/nameType/{properNoun} Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApi name_type_batch post /api2/json/nameTypeBatch Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
GeneralApi name_type_geo get /api2/json/nameTypeGeo/{properNoun}/{countryIso2} Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApi name_type_geo_batch post /api2/json/nameTypeGeoBatch Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
IndianApi caste_indian_batch post /api2/json/casteIndianBatch [USES 10 UNITS PER NAME] Infer the likely Indian name caste of up to 100 personal Indian Hindu names.
IndianApi castegroup_indian get /api2/json/castegroupIndian/{subDivisionIso31662}/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of a first / last name.
IndianApi castegroup_indian_batch post /api2/json/castegroupIndianBatch [USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of up to 100 personal first / last names.
IndianApi castegroup_indian_full get /api2/json/castegroupIndianFull/{subDivisionIso31662}/{personalNameFull} [USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of a personal full name.
IndianApi castegroup_indian_full_batch post /api2/json/castegroupIndianFullBatch [USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of up to 100 personal full names.
IndianApi castegroup_indian_hindu get /api2/json/casteIndian/{subDivisionIso31662}/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely Indian name caste of a personal Hindu name.
IndianApi religion get /api2/json/religionIndianFull/{subDivisionIso31662}/{personalNameFull} [USES 10 UNITS PER NAME] Infer the likely religion of a personal Indian full name, provided the Indian state or Union territory (NB/ this can be inferred using the subclassification endpoint).
IndianApi religion1 get /api2/json/religionIndian/{subDivisionIso31662}/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely religion of a personal Indian first/last name, provided the Indian state or Union territory (NB/ this can be inferred using the subclassification endpoint).
IndianApi religion_indian_batch post /api2/json/religionIndianBatch [USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal first/last Indian names, provided the subclassification at State or Union territory level (NB/ can be inferred using the subclassification endpoint).
IndianApi religion_indian_full_batch post /api2/json/religionIndianFullBatch [USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal full Indian names, provided the subclassification at State or Union territory level (NB/ can be inferred using the subclassification endpoint).
IndianApi subclassification_indian get /api2/json/subclassificationIndian/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2:IN based on the name.
IndianApi subclassification_indian_batch post /api2/json/subclassificationIndianBatch [USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2:IN based on a list of up to 100 names.
IndianApi subclassification_indian_full get /api2/json/subclassificationIndianFull/{fullName} [USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2:IN based on the name.
IndianApi subclassification_indian_full_batch post /api2/json/subclassificationIndianFullBatch [USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2:IN based on a list of up to 100 names.
JapaneseApi gender_japanese_name_full get /api2/json/genderJapaneseNameFull/{japaneseName} Infer the likely gender of a Japanese full name ex. 王晓明
JapaneseApi gender_japanese_name_full_batch post /api2/json/genderJapaneseNameFullBatch Infer the likely gender of up to 100 full names
JapaneseApi gender_japanese_name_pinyin get /api2/json/genderJapaneseName/{japaneseSurname}/{japaneseGivenName} Infer the likely gender of a Japanese name in LATIN (Pinyin).
JapaneseApi gender_japanese_name_pinyin_batch post /api2/json/genderJapaneseNameBatch Infer the likely gender of up to 100 Japanese names in LATIN (Pinyin).
JapaneseApi japanese_name_gender_kanji_candidates_batch post /api2/json/japaneseNameGenderKanjiCandidatesBatch Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname) with KNOWN gender, ex. Yamamoto Sanae
JapaneseApi japanese_name_kanji_candidates get /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin} Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae
JapaneseApi japanese_name_kanji_candidates1 get /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{knownGender} Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae - and a known gender.
JapaneseApi japanese_name_kanji_candidates_batch post /api2/json/japaneseNameKanjiCandidatesBatch Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname), ex. Yamamoto Sanae
JapaneseApi japanese_name_latin_candidates get /api2/json/japaneseNameLatinCandidates/{japaneseSurnameKanji}/{japaneseGivenNameKanji} Romanize japanese name, based on the name in Kanji.
JapaneseApi japanese_name_latin_candidates_batch post /api2/json/japaneseNameLatinCandidatesBatch Romanize japanese names, based on the name in KANJI
JapaneseApi japanese_name_match get /api2/json/japaneseNameMatch/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName} Return a score for matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApi japanese_name_match_batch post /api2/json/japaneseNameMatchBatch Return a score for matching a list of Japanese names in KANJI ex. 山本 早苗 with romanized names ex. Yamamoto Sanae
JapaneseApi japanese_name_match_feedback_loop get /api2/json/japaneseNameMatchFeedbackLoop/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName} [CREDITS 1 UNIT] Feedback loop to better perform matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApi parse_japanese_name get /api2/json/parseJapaneseName/{japaneseName} Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
JapaneseApi parse_japanese_name_batch post /api2/json/parseJapaneseNameBatch Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
PersonalApi corridor get /api2/json/corridor/{countryIso2From}/{firstNameFrom}/{lastNameFrom}/{countryIso2To}/{firstNameTo}/{lastNameTo} [USES 20 UNITS PER NAME COUPLE] Infer several classifications for a cross border interaction between names (ex. remit, travel, intl com)
PersonalApi corridor_batch post /api2/json/corridorBatch [USES 20 UNITS PER NAME PAIR] Infer several classifications for up to 100 cross border interaction between names (ex. remit, travel, intl com)
PersonalApi country get /api2/json/country/{personalNameFull} [USES 10 UNITS PER NAME] Infer the likely country of residence of a personal full name, or one surname. Assumes names as they are in the country of residence OR the country of origin.
PersonalApi country_batch post /api2/json/countryBatch [USES 10 UNITS PER NAME] Infer the likely country of residence of up to 100 personal full names, or surnames. Assumes names as they are in the country of residence OR the country of origin.
PersonalApi diaspora get /api2/json/diaspora/{countryIso2}/{firstName}/{lastName} [USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of a personal name, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApi diaspora_batch post /api2/json/diasporaBatch [USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of up to 100 personal names, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApi gender get /api2/json/gender/{firstName} Infer the likely gender of a just a fiven name, assuming default 'US' local context. Please use preferably full names and local geographic context for better accuracy.
PersonalApi gender1 get /api2/json/gender/{firstName}/{lastName} Infer the likely gender of a name.
PersonalApi gender_batch post /api2/json/genderBatch Infer the likely gender of up to 100 names, detecting automatically the cultural context.
PersonalApi gender_full get /api2/json/genderFull/{fullName} Infer the likely gender of a full name, ex. John H. Smith
PersonalApi gender_full_batch post /api2/json/genderFullBatch Infer the likely gender of up to 100 full names, detecting automatically the cultural context.
PersonalApi gender_full_geo get /api2/json/genderFullGeo/{fullName}/{countryIso2} Infer the likely gender of a full name, given a local context (ISO2 country code).
PersonalApi gender_full_geo_batch post /api2/json/genderFullGeoBatch Infer the likely gender of up to 100 full names, with a given cultural context (country ISO2 code).
PersonalApi gender_geo get /api2/json/genderGeo/{firstName}/{lastName}/{countryIso2} Infer the likely gender of a name, given a local context (ISO2 country code).
PersonalApi gender_geo_batch post /api2/json/genderGeoBatch Infer the likely gender of up to 100 names, each given a local context (ISO2 country code).
PersonalApi origin get /api2/json/origin/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely country of origin of a personal name. Assumes names as they are in the country of origin. For US, CA, AU, NZ and other melting-pots : use 'diaspora' instead.
PersonalApi origin_batch post /api2/json/originBatch [USES 10 UNITS PER NAME] Infer the likely country of origin of up to 100 names, detecting automatically the cultural context.
PersonalApi parse_name get /api2/json/parseName/{nameFull} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApi parse_name_batch post /api2/json/parseNameBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApi parse_name_geo get /api2/json/parseName/{nameFull}/{countryIso2} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. For better accuracy, provide a geographic context.
PersonalApi parse_name_geo_batch post /api2/json/parseNameGeoBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. Giving a local context improves precision.
PersonalApi religion2 get /api2/json/religion/{countryIso2}/{subDivisionIso31662}/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely religion of a personal first/last name. NB: only for INDIA (as of current version).
PersonalApi religion_batch post /api2/json/religionBatch [USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal first/last names. NB: only for India as of currently.
PersonalApi religion_full get /api2/json/religionFull/{countryIso2}/{subDivisionIso31662}/{personalNameFull} [USES 10 UNITS PER NAME] Infer the likely religion of a personal full name. NB: only for INDIA (as of current version).
PersonalApi religion_full_batch post /api2/json/religionFullBatch [USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal full names. NB: only for India as of currently.
PersonalApi subclassification get /api2/json/subclassification/{countryIso2}/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer the likely origin of a name at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
PersonalApi subclassification_batch post /api2/json/subclassificationBatch [USES 10 UNITS PER NAME] Infer the likely origin of a list of up to 100 names at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
PersonalApi subclassification_full get /api2/json/subclassificationFull/{countryIso2}/{fullName} [USES 10 UNITS PER NAME] Infer the likely origin of a name at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
PersonalApi subclassification_full_batch post /api2/json/subclassificationFullBatch [USES 10 UNITS PER NAME] Infer the likely origin of a list of up to 100 names at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
PersonalApi us_race_ethnicity get /api2/json/usRaceEthnicity/{firstName}/{lastName} [USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi us_race_ethnicity_batch post /api2/json/usRaceEthnicityBatch [USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi us_race_ethnicity_zip5 get /api2/json/usRaceEthnicityZIP5/{firstName}/{lastName}/{zip5Code} [USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy, using (optional) ZIP5 code info. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApi us_zip_race_ethnicity_batch post /api2/json/usZipRaceEthnicityBatch [USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy, with (optional) ZIP code. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
SocialApi phone_code get /api2/json/phoneCode/{firstName}/{lastName}/{phoneNumber} [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, given a personal name and formatted / unformatted phone number.
SocialApi phone_code_batch post /api2/json/phoneCodeBatch [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, detecting automatically the local context given a name and formatted / unformatted phone number.
SocialApi phone_code_geo get /api2/json/phoneCodeGeo/{firstName}/{lastName}/{phoneNumber}/{countryIso2} [USES 11 UNITS PER NAME] Infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).
SocialApi phone_code_geo_batch post /api2/json/phoneCodeGeoBatch [USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, with a local context (ISO2 country of residence).
SocialApi phone_code_geo_feedback_loop get /api2/json/phoneCodeGeoFeedbackLoop/{firstName}/{lastName}/{phoneNumber}/{phoneNumberE164}/{countryIso2} [CREDITS 1 UNIT] Feedback loop to better infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

api_key

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

Author

[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in openapi_client.apis and openapi_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from openapi_client.apis.default_api import DefaultApi
  • from openapi_client.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import openapi_client
from openapi_client.apis import *
from openapi_client.models import *

namsor-python-sdk2's People

Contributors

namsor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

namsor-python-sdk2's Issues

Error 500 (NullPointerException) when processing OriginBatch with a null lastName

Processing a batch request with a null lastName results in an API 500 error,


 java.lang.NullPointerException
        at com.namsor.api2.classify.AIParsedNameOriginCountryClassifier.features(AIParsedNameOriginCountryClassifier.java:106)
        at com.namsor.api2.classify.AIClassifier.classifyDetailsFact(AIClassifier.java:272)
        at com.namsor.api2.classify.AI.predictOrigin(AI.java:349)

The API should process all other names and return a null origin for the name where lastName is null.

ModuleNotFoundError: No module named 'openapi_client.exceptions'

Hello,

After following the Installation Procedure mentioned in the Readme file, whenever I run the code snippet in Getting started section I get the following error when I import openapi_client:
ModuleNotFoundError: No module named 'openapi_client.exceptions'

It seems to occur in the rest.py file mainly when it try to import the following line:
from openapi_client.exceptions import ApiException, ApiValueError

How may this be solved? I tried to look in the source code but didn't find the following 'openapi_client.exceptions' directory.

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.