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:
- Is my python code ok so far?
- 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.