Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 883215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:33:04+00:00 2026-05-15T12:33:04+00:00

I learning Python (coming from a dotnet background) and developing an app which interacts

  • 0

I learning Python (coming from a dotnet background) and developing an app which interacts with a webservice.

The web service is flat, in that it has numerous calls some of which are related to sessions e.g. logging on etc, whereas other calls are related to retrieving/setting business data.

To accompany the webservice, there are a couple of python classes which wrap all the calls. I am looking to develop a client on top of that class but give the client more OO structure.

The design of my own app was to have a Session-type class which would be responsible for logging on/maintaining the connection etc , but itself would be injected into a Business-type class which is responsible for making all the business calls.

So the stack is something like

WebService          (Soap)   
 WebServiceWrapper  (Python)
  Session           (Python)
   Business         (Python)

Here’s a sample of my code (I’ve renamed some methods to try and make stuff more explicit)

from webServiceWrapper import webServiceAPI

class Session():
    def __init__(self, user, password):
        self._api = webServiceAPI()
        self.login = self._api.login(user, password) 

    def webServiceCalls(self):
        return self._api()

class Business():
    def __init__(self, service):
        self._service=service

    def getBusinessData(self):
        return self._service.get_business_data()

and my unit test

class exchange(unittest.TestCase):
    def setUp(self):
        self.service = Session("username","password")
        self._business = Business(self.service.webServiceCalls())

    def testBusinessReturnsData(self):
        self.assertFalse(self._business.getBusinessData()==None)

The unit test fails fails on

return self._api() 

saying that the underlying class is not callable

TypeError: 'webServiceAPI' is not callable

My first q is, is that the python way? Is the OO thinking which underpins app development with static languages good for dynamic as well? (That’s probably quite a big q!)

My second q is that, if this kind of architecture is ok, what am I doing wrong (I guess in terms of passing references to objects in this way)?

Many thx

S

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:33:05+00:00Added an answer on May 15, 2026 at 12:33 pm

    If WebserviceAPI is an object just remove the parentheses like that:

    return self._api 
    

    You already created an instance of the object in the constructor.

    Maybe add the definition of WebserviceAPI to the question, I can only guess at the moment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

learning python, coming from a php background. Keeping it short. Is there a way
I'm learning c++ coming from a background in python. I'm wondering is there a
I'm currently learning Python and coming from a strong C# background. I keep hearing
I'm learning python and Django coming from PHP. This is all really exciting, and
I just started learning C++(coming from Java & Python) and am trying to learn
I'm learning C# coming from python and wish to know how the C# garbage
I'm learning Python and trying to test some rest web_service applications. From the below
I am just learning python and Qt these days. So please consider that this
I am thinking about learning Clojure, but coming from the c-syntax based (java, php,
I've pretty much tried every Python web framework that exists, and it took me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.