I am trying to give user a temporary link to download files from Amazon S3 bucket in python.
I am using generate_url method which generates the url for a specified time peiod.
My concern is when this link is created,anyone including the desired user can hit this url in that time period and get the files.How can I prevent other people from getting access to the files ?
Make sure that the expiration time of the link is set to a very short time.  Then make sure that you are communicating with the user via SSL, and that the link provided is SSL.  When using an SSL connection, both the data from the page and the URL are encrypted, and no one 'sniffing' the data should be able to see anything.
The only other way to put a real lock down on a file like that would be to then aggressively check the log files generated by the S3 bucket, and check the link for abuse.  The problem however is that the traffic for your link may take several hours to make it into logs, but dependant on how long you want these links to last that time delay may be acceptable.  Then assuming you find abuse, such as several different IP addresses hitting the link, you can stop the hits by renaming the file on S3.
The ultimate is for your server to grab the data off S3 and spoon feed it to the customer.  Then it is impossible for anyone to get the file unless you authenticate them and they remain in the session.  The big downer of course is that you are taxing your server, and are defeating half the reason S3 is cool, namely you don't have to serve the file, S3 does.  But if your server is on Amazon EC2, there is no cost in pulling from S3, only the download to the customer would be charged.  Additionally EC2 instances can access and download data from S3 at local network levels of speed, and like I said its free.
How to generate a secure temporary url to download file from Amazon S3?