Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

Expand Down
6 changes: 6 additions & 0 deletions integration_test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion openapi_generated/pinterest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""


__version__ = "0.1.9"
__version__ = "0.1.10"

# import ApiClient
from openapi_generated.pinterest_client.api_client import ApiClient
Expand Down
2 changes: 1 addition & 1 deletion openapi_generated/pinterest_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 == 1.26.12
urllib3 == 1.26.20
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -31,7 +31,7 @@
# http://pypi.python.org/pypi/setuptools

REQUIRES = [
"urllib3==1.26.12",
"urllib3==1.26.20",
"python-dateutil",
]

Expand Down
23 changes: 8 additions & 15 deletions spec/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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/##//'
2 changes: 1 addition & 1 deletion spec/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/local-open-generator-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
java -jar openapi-generator-cli.jar "$@"
Binary file added spec/openapi-generator-cli.jar
Binary file not shown.
28 changes: 28 additions & 0 deletions spec/patches/remove_bool_none_type.py
Original file line number Diff line number Diff line change
@@ -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.")
2 changes: 1 addition & 1 deletion spec/templates/requirements.mustache
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 == 1.26.12
urllib3 == 1.26.20
2 changes: 1 addition & 1 deletion spec/templates/setup.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading