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 8848867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:30:13+00:00 2026-06-14T12:30:13+00:00

To trigger the update you have to visit a url in the browser. This

  • 0

To trigger the update you have to visit a url in the browser. This script was made in shell to do it:

#!/bin/bash
# Bash to initiate Solr Delta Import Handler

# Setup Variables
hostName=localhost
portNum=8080
SOLRPATH=/solr
SOLR='delta-import&clean=false'
STATUS='dataimport?command=status'
urlCmd='http://${hostName}:${portNum}${SOLRPATH}/dataimport?command=${SOLRCMD}"

# Operations
curl $URLCMD 

I have tried to write this in Python, this is how far I got:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Setup Variables
hostName='localhost'
portNum='8080'
SOLRPATH='/solr'
SOLRCMD='delta-import&clean=false'
STATUSCMD='dataimport?command=status'
urlCmd='http://${hostName}:${portNum}${SOLRPATH}/dataimport?command=${SOLRCMD}'

# Alternative to Curl {URLCMD}

So basically I have two questions:

  1. Is my python code ok so far?
  2. What is a simple alterantive to Curl in python? The event is normally triggered just by visiting the URL but I dont know how to do this in Python simply.
  • 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-06-14T12:30:14+00:00Added an answer on June 14, 2026 at 12:30 pm

    First of all, use one of these kinds of string formatting in Python:

    urlCmd='http://{0}:{1}{2}/dataimport?command={3}'.format(hostName,portnum, SOLRPATH, SOLRCMD)
    #or
    urlCmd='http://%s:%s%s/dataimport?command=%s' % (hostName,portnum, SOLRPATH, SOLRCMD)
    

    While there is pycurl in python that uses libcurl, you should use a builtin module like urllib2 to access the URL you generated if you want your script to stay portable.

    import urllib2
    req = urllib2.urlopen(urlCmd)
    

    Now there are several things you can do with your request:

    req.close      req.fileno     req.getcode    req.headers    req.msg  
    req.read       req.readlines  req.code       req.fp         req.geturl   
    req.info       req.next       req.readline   req.url
    

    While most of the methods are self explanatory, refer to the urllib2 docs for a detailed explanation of what they do.

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

Sidebar

Related Questions

I have made a simple physics sprite that will automatically trigger update selector and
I have an UPDATE trigger that produces INSERTED and DELETED table like this: INSERTED
I have created this trigger to update the seq column. I have to keep
I have a trigger for insert/update/delete. That is working fine. Also, I need the
I have a stored procedure which is called inside a trigger on Insert/Update/Delete. The
I have a search button tied to an update panel as a trigger like
I have a table trigger like below: CREATE OR REPLACE TRIGGER PAT_BUR_DOB_TRG BEFORE UPDATE
I have a table where on a single record update, a trigger adds a
I have such SqLite trigger: CREATE TRIGGER update_rating AFTER UPDATE ON gameServers FOR EACH
i have this simple plpgsql function: CREATE FUNCTION update_times () RETURNS trigger AS '

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.