Skip to content

where to find mapping info between country codes and full country names ? #224

Closed

Description

@cn-knight

In the credentials.yml example, country names are used in full form (e.g., "germany",...), but in the API code (like marketplaces.py), countries are referenced using their ISO codes (e.g., "DE", "GB").

In the whole API docs, is there any file with mapping between country codes and full country names ?

MARKET_CODE_TO_NAME = {
'UK': 'united_kingdom',
'GB': 'united_kingdom',
'DE': 'germany',
'FR': 'france',
# etc.
}

My questions:

  1. Is there an existing mapping function or constant in the library that I've missed?
  2. If not, would it make sense to add this mapping to the library to maintain consistency?

This would greatly simplify implementation for users who wouldn't need to create and maintain this mapping in every script they write.

Thank you!

Activity

  1. denisneuf commented on Mar 31, 2025

    @denisneuf
    Owner

    Here:

    https://github.com/denisneuf/python-amazon-ad-api/blob/main/ad_api/base/marketplaces.py

    Please notice the readme files:

    Marketplaces

    Marketplaces are used to define basically the API endpoints Amazon need to use depending on the regions, by default it will use EU so if you are using one of the marketplaces that are under the Europe (EU). Covers UK, FR, IT, ES, DE, NL, AE, SE, PL, and TR marketplaces you can skip. If you are using either North America (NA) or Far East (FE), you will need import from base and pass the marketplace as follows:

    from ad_api.api import sponsored_products
    from ad_api.base import Marketplaces

    You can pass NA or US, CA, MX or BR for North America and JP, AU or SG for Far East

    result=sponsored_products.CampaignsV3(marketplace=Marketplaces.NA).list_campaigns()

  2. Repository owner locked and limited conversation to collaborators on Mar 31, 2025
  3. converted this issue into a discussion #226 on Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions