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

  • Home
  • SEARCH
  • 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 6898609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:19:06+00:00 2026-05-27T07:19:06+00:00

I’m working on a Python script that accesses number of websites. I don’t think

  • 0

I’m working on a Python script that accesses number of websites. I don’t think writing a whole class for each website is a feasible option, so I am looking for a way to reduce the code and re-use code as much as I can and write it as efficiently as I can. Although the website share same or similar engine (e.g. WordPress), they often differ with slight details like cookie names, changed URL paths (e.g. example.com/signin.php and example2.com/login.php), data names and values for POST requests, and so on.

In most cases I could use variables, but sometimes I need to find extra data from retrieved url in the middle of method to continue, so that means adding few lines of code that needs to be processed before proceeding. I found that possible solution for me could theoretically be to use superclasses. But I couldn’t find any information how to actually ‘step into’ a method to make changes. To better illustrate my point, take a look at this example

class WordPress(object):
    def login(self):
        # Do some stuff here


    def newentry(self):
        # Code to check if I'm logged in code
        # and do bunch of other stuff
        #
        # Retrieve a page that *** sometimes contain important information 
        # in which case must be processed to continue! ***
        data = {'name'  : title,
                'message' : message,
                'icon' : iconid}
        # Post new entry here

As I already commented in the example above in some cases I need to make adjustement just inside a method itself, add snippet of code, or change value of the variable or value in the dictionary, etc.. How can I achieve that, if it’s even possible? Maybe my perception of superclasses is way off and they aren’t really for what I think they are.

Maybe there’s other way I haven’t thought of. Feel free to post your own ideas how you would solve this problem. I am looking forward to your replies. Thank you.

  • 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-27T07:19:06+00:00Added an answer on May 27, 2026 at 7:19 am

    Why can’t you just call some process function from the main method, process can do whatever you want it to do, and you can even override it in derived classes e.g.

    class WordPress(object):
        def newentry(self):
            data = get_data()
            data = process_data(data)
    
            # do moe generi cthings
    
        def process_data(self):
            return data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a python script that starts several processes and database connections. Every
I'm working on a Python script that transforms this: foo bar Into this: [[Component
I'm working on a PHP script that runs a Python script on the server.
I'm working on a Bash shell script that runs several Python scripts like so:
I have a working Python script that executes an external command and calls Popen.communicate()
I'm working on a simple Python script that can use subprocess and/or os to
I'm working to create a simple Python script that will ultimately tell you how
I'm working on a Python script that creates text files containing size/space information about
I have a python script that is writing text to images using the PIL.
I'm currently working on a simple Python script that connects to an IP/Port and

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.