diff --git a/README.md b/README.md index 14d5887..4680b6a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Pinterest's REST API This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 5.14.0 -- Package version: 0.1.9 +- Package version: 0.1.10 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://developers.pinterest.com/](https://developers.pinterest.com/) diff --git a/integration_test/base.py b/integration_test/base.py index f0f1d4c..31a689d 100644 --- a/integration_test/base.py +++ b/integration_test/base.py @@ -11,6 +11,8 @@ from openapi_generated.pinterest_client.model.campaign_create_request import CampaignCreateRequest from openapi_generated.pinterest_client.model.objective_type import ObjectiveType from openapi_generated.pinterest_client.model.pin_create import PinCreate +from openapi_generated.pinterest_client.model.targeting_spec import TargetingSpec + from .config import DEFAULT_AD_ACCOUNT_ID from .config import DEFAULT_AD_ACCOUNT_COUNTRY from .config import DEFAULT_AD_ACCOUNT_NAME @@ -116,6 +118,10 @@ def ad_group(self): billable_event=action_type, tracking_url=None, bid_in_micro_currency=5000000, + targeting_spec=TargetingSpec( + age_bucket=["35-44"], + location=[DEFAULT_AD_ACCOUNT_COUNTRY], + ) )], ) self._ad_group = parse_to_object(response) diff --git a/openapi_generated/pinterest_client/__init__.py b/openapi_generated/pinterest_client/__init__.py index a6fbe81..5ce70b3 100644 --- a/openapi_generated/pinterest_client/__init__.py +++ b/openapi_generated/pinterest_client/__init__.py @@ -11,7 +11,7 @@ """ -__version__ = "0.1.9" +__version__ = "0.1.10" # import ApiClient from openapi_generated.pinterest_client.api_client import ApiClient diff --git a/openapi_generated/pinterest_client/configuration.py b/openapi_generated/pinterest_client/configuration.py index e65437c..94068b2 100644 --- a/openapi_generated/pinterest_client/configuration.py +++ b/openapi_generated/pinterest_client/configuration.py @@ -426,7 +426,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 5.14.0\n"\ - "SDK Package Version: 0.1.9".\ + "SDK Package Version: 0.1.10".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/requirements.txt b/requirements.txt index ca7ebcd..ce41c00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 -urllib3 == 1.26.12 \ No newline at end of file +urllib3 == 1.26.20 \ No newline at end of file diff --git a/setup.py b/setup.py index 4edae42..1b348e5 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ import os -VERSION = "0.1.9" +VERSION = "0.1.10" _IS_TEST_BUILD = os.environ.get("IS_TEST_BUILD", 0) if _IS_TEST_BUILD: @@ -31,7 +31,7 @@ # http://pypi.python.org/pypi/setuptools REQUIRES = [ - "urllib3==1.26.12", + "urllib3==1.26.20", "python-dateutil", ] diff --git a/spec/Makefile b/spec/Makefile index 782c027..664a7f2 100644 --- a/spec/Makefile +++ b/spec/Makefile @@ -1,18 +1,6 @@ SHELL:=bash OPENAPI_GENERATOR_VERSION:=5.4.0 -OPENAPI_GENERATOR_COMMAND:=openapi-generator-cli - -ifeq (, $(shell which $(OPENAPI_GENERATOR_COMMAND))) -OPENAPI_GENERATOR_COMMAND = openapi-generator -endif - -ifeq (, $(shell which $(OPENAPI_GENERATOR_COMMAND))) -$(error Error: Command '$(OPENAPI_GENERATOR_COMMAND)' not found, make sure 'openapi-generator' is installed globablly) -endif - -ifneq ($(shell OPENAPI_GENERATOR_VERSION=$(OPENAPI_GENERATOR_VERSION) $(OPENAPI_GENERATOR_COMMAND) version), $(OPENAPI_GENERATOR_VERSION)) -$(error Error: Expected $(OPENAPI_GENERATOR_COMMAND) version $(OPENAPI_GENERATOR_VERSION) (found $(shell $(OPENAPI_GENERATOR_COMMAND) version))) -endif +OPENAPI_GENERATOR_COMMAND:=local-openapi-generator-cli # Additional debugging output can be enabled by setting e.g. DEBUG_MODELS=1. ifeq ($(DEBUG_MODELS),1) @@ -30,12 +18,17 @@ download_spec: ## Download openapi.yaml from public pinterest github repo validate_spec: ## Validates the openapi spec: sdk.yaml @echo ====Validates the openapi spec: sdk.yaml==== - openapi-generator validate -i openapi.yaml + ./local-open-generator-cli validate -i openapi.yaml generate_client: ## Generates a python client @echo ====Generates a python client using the sdk.yaml spec==== - openapi-generator generate -c config.yml -o .. + ./local-open-generator-cli generate -c config.yml -o .. rm -rf ../test ../.gitlab-ci.yml ../.travis.yml ../git_push.sh + +generate_client: ## Patch the generated client + @echo ====Execiting patches==== + python ./patches/remove_bool_none_type.py + help: ## Show list of targets and purposes. @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' \ No newline at end of file diff --git a/spec/config.yml b/spec/config.yml index 151bf76..eb3a160 100644 --- a/spec/config.yml +++ b/spec/config.yml @@ -3,7 +3,7 @@ generatorStability: STABLE generatorType: CLIENT generatorLanguage: python inputSpec: openapi.yaml -packageVersion: 0.1.9 +packageVersion: 0.1.10 projectName: Pinterest_Generated_Client templateDir: templates packageName: openapi_generated.pinterest_client diff --git a/spec/local-open-generator-cli b/spec/local-open-generator-cli new file mode 100755 index 0000000..d755bb8 --- /dev/null +++ b/spec/local-open-generator-cli @@ -0,0 +1,2 @@ +#!/bin/bash +java -jar openapi-generator-cli.jar "$@" \ No newline at end of file diff --git a/spec/openapi-generator-cli.jar b/spec/openapi-generator-cli.jar new file mode 100644 index 0000000..0071b94 Binary files /dev/null and b/spec/openapi-generator-cli.jar differ diff --git a/spec/patches/remove_bool_none_type.py b/spec/patches/remove_bool_none_type.py new file mode 100644 index 0000000..fe448d0 --- /dev/null +++ b/spec/patches/remove_bool_none_type.py @@ -0,0 +1,28 @@ +""" +This script removes the import line "from openapi_generated.pinterest_client.model.bool_none_type import BoolNoneType" +from all Python files in the 'openapi_generated' directory and its subdirectories. This is to fix the error: +"ModuleNotFoundError: No module named 'openapi_generated.pinterest_client.model.bool_none_type'" +""" +import os + +directory = '../openapi_generated' +line_to_remove = "from openapi_generated.pinterest_client.model.bool_none_type import BoolNoneType" + +print("Starting the script to remove the specified import line from all Python files in the 'openapi_generated' directory...") + +for root, dirs, files in os.walk(directory): + for file in files: + if file.endswith(".py"): + file_path = os.path.join(root, file) + + with open(file_path, 'r', encoding='utf-8') as f: + lines = f.readlines() + + with open(file_path, 'w', encoding='utf-8') as f: + for line in lines: + if line.strip() != line_to_remove: + f.write(line) + else: + print(f"Removed line from: {file_path}") + +print("Script completed. The specified import line has been removed from all Python files in the 'openapi_generated' directory.") \ No newline at end of file diff --git a/spec/templates/requirements.mustache b/spec/templates/requirements.mustache index ca7ebcd..ce41c00 100644 --- a/spec/templates/requirements.mustache +++ b/spec/templates/requirements.mustache @@ -1,3 +1,3 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 -urllib3 == 1.26.12 \ No newline at end of file +urllib3 == 1.26.20 \ No newline at end of file diff --git a/spec/templates/setup.mustache b/spec/templates/setup.mustache index aad6081..33b7303 100644 --- a/spec/templates/setup.mustache +++ b/spec/templates/setup.mustache @@ -25,7 +25,7 @@ NAME = "{{{projectName}}}" # http://pypi.python.org/pypi/setuptools REQUIRES = [ - "urllib3==1.26.12", + "urllib3==1.26.20", "python-dateutil", {{#asyncio}} "aiohttp >= 3.0.0",