-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
rifkybujana
commented
Aug 1, 2023
It would be awesome if someone can review it and do some test on it.
assulthoni
commented
Aug 20, 2023
That's really awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very love your propose to create universal function to interact with webapi. Unfortunately this function not working well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May i know details on the result or error produced by the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below result when call client.view_publication('0000','0') :
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/my-user/Documents/GitHub/stadata/stadata/main.py", line 567, in view_publication res = self.__get_view(domain=domain,model='publication',idx=id,lang='ind') File "/Users/my-user/Documents/GitHub/stadata/stadata/main.py", line 174, in __get_view return requests_model.view(self.TOKEN) File "/Users/my-user/Documents/GitHub/stadata/stadata/main.py", line 22, in decorated if args[0].TOKEN == '': AttributeError: 'RequestModel' object has no attribute 'TOKEN'
I have made significant changes to the web API request to make it more modular, simpler, and easier to read. Although, it might require some tests to make sure everything still running okay. I've used decorator to validate each request instead of writing a repetitive
if(res.status_code != 200): ..., and make each request url easier to edit by combining it into one class.