Hi All,

Sorry for my posting if it was already in the forum. I could not find the answer to my question.
I am newbie. I have never programmed anything. I just started to learn. Now I want to do is to produce automated searches. How can I do that? I am a freelancer consultant. Sometimes I have bunches of terms to search in an engine. Sometimes I need to track who visited my professional blog. I have IP addresses of visitors and I manually search them in a web site. I have noticed that when I enter an IP address the resulting page is in that format: http://www.domaincom/search/iplocation.asp?ipaddress=191.1X.1XX.1XX.
Here is the question:
How can I automatize this with a Python script?

Thanks beforehand.
Best

Hi, I'm basically a programming hobbiest and new to this forum so I may be wrong, but that being said I don't think you have provided enough information here. Unless of course you are wanting someone to point you in the right direction, or actually code something for you. I'm guessing if you are a newbie the first thing to do would be to first learn a bit about the language. Then ask yourself a few questions, such as. What does python offer that could preform this task I want to automate? One thing I can be sure of is you want to manipulate the string http://www.domaincom/search/iplocati...191.1X.1XX.1XX. I know that python can handle this task no problem. Read up on strings in any beginner tutorial and you should find a solution to this part. The next question would probably be how am I going to pass this information to python, or do i want python to access this information on its own. Depending on the answer to that question, you may be looking at a very simple code, to a much more sophisticated code. Anyway from my exeprience this is the type of process you go through for just about any program you intend to make. And I think you will be better equipt to ask questions if you first go through that process.

More info, plz.

State clearly what you are trying to to. Are you going to try and use python to parse the results (via html scrape)? Because that would likely mean regular expressions and that would be tough.

Thanks for replies. Yes I started with python as it seems to be the easiest one for a newbie, especially with a linguistics background:) In deed what I want is to search IP addresses location. I have a log which keeps IP of the visitors of my blog. After that, maybe I modify the code and use it for linguistic purposes, from google for example. In deed I searched it on the net but was lost in google:) Such tasks are related to cgi? Or where should I start? Thanks.
Best

Here's where you should always start:

What is your input to the script? This should be something tangible, a trigger, a file, some sort of a parameter you are going to pass.

What will your script do, and ultimately output?

Then, we can probably help you out with some code.

I have a log which keeps IP of the visitors of my blog

Start with file open and readlines to get the file into memory. Then decide how you are going to identify an IP address. If it is the only thing on the line that has digits, or is always in the same string such as "IP Address 123.34.789" then it is easy to filter out. Here is a simple example that you should be able to use to start with http://pythonstarter.blogspot.com/search/label/python%20readlines http://pythonstarter.blogspot.com/2009/04/python-readline-example-for-newbie.html This is a link to (mostly) online books and tutorials http://linkmingle.com/list/List-of-Free-Online-Python-Books-freebooksandarticles

Start with file open and readlines to get the file into memory. Then decide how you are going to identify an IP address. If it is the only thing on the line that has digits, or is always in the same string such as "IP Address 123.34.789" then it is easy to filter out. Here is a simple example that you should be able to use to start with http://pythonstarter.blogspot.com/search/label/python%20readlines http://pythonstarter.blogspot.com/2009/04/python-readline-example-for-newbie.html This is a link to (mostly) online books and tutorials http://linkmingle.com/list/List-of-Free-Online-Python-Books-freebooksandarticles

thanks all.

Post any code you're having problems with. I as said earlier, it is fairly straight forward, so don't waste too much time reinventing the wheel.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.