-3
Hey, you guys. I’m new to Python and need to deliver a script of requests Apis. There are three attributes required to request the API (client_id, client_secret and text), and the two "clients" are sensitive information and cannot be displayed in the script.
I created functions in the config file to take this two information, and in the main script I want to call. The point is that I am not able to call.
def get_client_id():
Config().get_client_id ##essa função chama o client_id que está no arquivo Config.py
def get_client_secret():
Config().get_client_secret ##essa função chama o client_id que está no arquivo Config.py
resp = NomeApi().request_api({self.get_client_id()}, {self.get_client_secret()}, texto="Q1JFQVRFIEVYVEVSTkFMIFR=")
#os get_clients não estão conseguindo chamar o valor que está na classe Config.py
Legend: Nomepi() is the class containing all functions request_api() is the main function to request the API
My guess is that the parentheses are missing at the end to call the methods (ex:
Config().get_client_id()
). But without seeing the whole code it’s hard to guess.– jfaccioni
Thank you for the touch. I put the parentheses to keep the good practices, but it ran without also. I got a solution and put in the answer below. Valeuss!!
– Nakano
You don’t need to put "solved" in the title. I know it’s common in many forums, but here it works different. In your case, as you yourself have found the solution, it is enough mark your reply below as accepted, this is enough to indicate that it was solved (as it was yourself who answered, I think the system only allows you to do this after a few hours, but anyway, just wait for the deadline...)
– hkotsubo