Package: altdg
AltDG API Python ToolsCommand-line tool with methods to consume theAltDG APIin bulk.©Alternative Data Group. All rights reserved.ContentsAltDG API Python ToolsContentsRequirementsInstallationAuthorizationFree tier keyUsageDomain mapperMerchant mapperProduct mapperCommand arguments (options)DevelopmentUsage as librarySupportRequirementsPython 3.6+See also requirements.txtInstallationRun the following commands in your shell:# install as usual python packagepipinstallaltdg# ... or install "altdg" package directly from repopipinstallgit+https://github.com/altdg/bulk_mapper.git# ... or if you want to get samples for testing, clone the repogitclonehttps://github.com/altdg/bulk_mapper.gitaltdg
pipinstall-ealtdgNow everything is ready to run the tool.AuthorizationTo use this tool you must have a valid app key to theAltDG API.
Methods are available depending on you account type with AltDG.Free tier keyUse this key to try the API for free:f816b9125492069f7f2e3b1cc60659f0Sign up athttps://developer.altdg.com/to get a non-trial key.UsageA preferred way to run the tool is to load it as module with thepythoncommand.Run the tool with--helpflag to display command's usage:altdg--helpDomain mapperMaps domain names from given text to structured company information.More details inhttps://developer.altdg.com/docs#domain-mapperThis will run all the domains in the provided text file (one per line expected):altdg-edomain-mappersample-domains.txt-k"f816b9125492069f7f2e3b1cc60659f0"Sign up athttps://developer.altdg.com/to get a non-trial key.A CSV output file will be created automatically with the same path as the input file but prepending the current date.sample-domains.txtis a sample list of domains we included in our repo. This file is downloaded as part of this package, no need to re-create it.Merchant mapperMaps strings from transactional purchase text (e.g. credit card transactions) to structured company information.More details inhttps://developer.altdg.com/docs#merchant-mapperaltdg-emerchant-mappersample-merchants.txt-k"f816b9125492069f7f2e3b1cc60659f0"Sign up athttps://developer.altdg.com/to get a non-trial key.A CSV output file will be created automatically with the same path as the input file but prepending the current date.sample-merchants.txtis a sample list of domains we included in our repo. This file is downloaded as part of this package, no need to re-create it.Product mapperMaps strings from product related text (e.g. inventory) to structured company information.More details inhttps://developer.altdg.com/docs#product-mapperaltdg-eproduct-mappersample-products.txt-k"f816b9125492069f7f2e3b1cc60659f0"Sign up athttps://developer.altdg.com/to get a non-trial key.A CSV output file will be created automatically with the same path as the input file but prepending the current date.Command arguments (options)Arguments:-e <endpoint>--endpointType of mapper. Choices are "merchant-mapper", "domain-mapper" and "product-mapper".-k <key>--keyAltDG API application key.-o <filename>--outOutput file path. If not provided, the input file name is used with the ".csv" extension, prepended with the date and time.-F--forceWhen providing a specific out_file, some results may already exist in that file for an input.
Use this option to force re-process results that are already in that output file, otherwise existing
results won't be processed again. Previous results are NOT overwritten, a new CSV row is added.-n--num-threadsNumber of requests to process in parallel. (See--helpfor max and default)-r--num-retiresNumber of retries per request. (See--helpfor max and default)-t--timeoutAPI request timeout (in seconds). (See--helpfor max and default)-th <hint>--type-hintImproves the accuracy by providing the industry name or any keyword hint relevant to the inputs. E.g.-th "medical"Usage as libraryYou may useAltdgAPIclass from your python program:fromaltdg.apiimportAltdgAPI# initialize Mapper class with your keymapper=AltdgAPI('domain-mapper',api_key='f816b9125492069f7f2e3b1cc60659f0')# single queryprint(mapper.query('abc.com'))# single query with hintprint(mapper.query('abc.com',hint='news'))# bulk queryprint(mapper.bulk_query(['yahoo.com','amazon.com']))# bulk query with same hint for all inputsprint(mapper.bulk_query(['yahoo.com','amazon.com'],hint='company'))# bulk query with overwriting hintprint(mapper.bulk_query([('purple mint','restaurant'),# (input, hint) tuple'amazon',# just input with base hint],hint='company'))# base hintSupportPlease emailinfo@altdg.comif you need to contact us directly.