-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Falta de imports #27
Comments
Ja aproveitando a issue vou listar algumas coisas que reparei
from pagarmeapisdk.pagarmeapisdk_client import PagarmeapisdkClient
from pagarmeapisdk.configuration import Environment
from pagarmeapisdk.models.create_address_request import CreateAddressRequest
import os
from dotenv import load_dotenv
load_dotenv(".env/.env")
client: PagarmeapisdkClient = PagarmeapisdkClient(
service_referer_name='Adda',
basic_auth_user_name=os.getenv("pagarme_secret"),
# basic_auth_password='',
environment=Environment.PRODUCTION
)
customers_controller = client.customers
customer_id = 'cus_wG6WG1C7XSANqKoR'
request = CreateAddressRequest(
street='street6',
number='444',
zip_code='60175000',
neighborhood='neighborhood2',
city='city6',
state='state2',
country='BR',
complement='complement2',
line_1='line_10',
line_2='line_24'
)
result = customers_controller.create_address(
customer_id,
request
)
print(result) ERRO:
|
@OMarcusCastro obrigado por compartilhar. Estou tendo o mesmo problema em outro controller. charge_response = client.charges.get_charge(charge_id="ch_VZ4A370QFaH6KEdW") ---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[25], line 1
----> 1 charge_response = client.charges.get_charge(charge_id="ch_VZ4A370QFaH6KEdW")
File /usr/local/lib/python3.9/site-packages/pagarmeapisdk/controllers/charges_controller.py:440, in ChargesController.get_charge(self, charge_id)
420 def get_charge(self,
421 charge_id):
422 """Does a GET request to /charges/{charge_id}.
423
424 Get a charge from its id
(...)
437
438 """
--> 440 return super().new_api_call_builder.request(
441 RequestBuilder().server(Server.DEFAULT)
442 .path('/charges/{charge_id}')
443 .http_method(HttpMethodEnum.GET)
444 .template_param(Parameter()
445 .key('charge_id')
446 .value(charge_id)
447 .should_encode(True))
448 .header_param(Parameter()
449 .key('accept')
450 .value('application/json'))
451 .auth(Single('global'))
452 ).response(
453 ResponseHandler()
454 .deserializer(APIHelper.json_deserialize)
455 .deserialize_into(GetChargeResponse.from_dictionary)
456 ).execute()
File /usr/local/lib/python3.9/site-packages/apimatic_core/api_call.py:72, in ApiCall.execute(self)
65 self._endpoint_logger.debug("Raw response for {} is: {}".format(
66 self._endpoint_name_for_logging, vars(_http_response)))
68 self.update_http_callback(_http_callback,
69 _http_callback.on_after_response if _http_callback is not None else None,
70 _http_response, "Calling on_after_response method of http_call_back for {}.")
---> 72 return self._response_handler.endpoint_logger(self._endpoint_logger) \
73 .endpoint_name_for_logging(self._endpoint_name_for_logging) \
74 .handle(_http_response, self._global_configuration.get_global_errors())
75 except Exception as e:
76 self._endpoint_logger.error(e)
File /usr/local/lib/python3.9/site-packages/apimatic_core/response_handler.py:86, in ResponseHandler.handle(self, response, global_errors)
83 self.validate(response, global_errors)
85 # applying deserializer if configured
---> 86 deserialized_value = self.apply_deserializer(response)
88 # applying api_response if configured
89 deserialized_value = self.apply_api_response(response, deserialized_value)
File /usr/local/lib/python3.9/site-packages/apimatic_core/response_handler.py:113, in ResponseHandler.apply_deserializer(self, response)
111 return self.apply_xml_deserializer(response)
112 elif self._deserialize_into:
--> 113 return self._deserializer(response.text, self._deserialize_into)
114 elif self._deserializer and not self._datetime_format:
115 return self._deserializer(response.text)
File /usr/local/lib/python3.9/site-packages/apimatic_core/utilities/api_helper.py:125, in ApiHelper.json_deserialize(json, unboxing_function, as_dict)
123 return [unboxing_function(element) for element in decoded]
124 else:
--> 125 return unboxing_function(decoded)
File /usr/local/lib/python3.9/site-packages/pagarmeapisdk/models/get_charge_response.py:236, in GetChargeResponse.from_dictionary(cls, dictionary)
234 invoice = APIHelper.SKIP
235 if 'order' in dictionary.keys():
--> 236 order = GetOrderResponse.from_dictionary(dictionary.get('order')) if dictionary.get('order') else None
237 else:
238 order = APIHelper.SKIP
NameError: name 'GetOrderResponse' is not defined saberia me informar se tem alguem da Pagarme corrigindo esses erros? |
As issues pelo que me aparenta ainda não foram corrigidas. Você pode tentar falar com o suporte. Pra resolver oq você enfrenta aí eu fiz o import desse getorderresponse pra função da Lib deles que chama isso. Tem um pull request que eu sugeri corrigindo isso |
Quando testamos os controladores a documentação possui exemplos mas nao possui referencias em relação a importa e a configuração deles em relação ao client. Ter isso ajudaria muito no processo de Debug. Se for testar diretamente com os exemplos da varios erros de import
The text was updated successfully, but these errors were encountered: