LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-06-2015, 11:08 PM   #1
firoj.26
LQ Newbie
 
Registered: Jul 2015
Posts: 1

Rep: Reputation: Disabled
python script hang over the screen method in cloud


I have an issue with running python scripts on linode cloud server. I create a scrapping script to scrape data by check in and check out so that i run the script using screen method. It run over one day very smoothly but today it hang. No response. When i call getRequest() method then i print the proxy number and send request with proxy and timeout=10.

Code:
def getRequest(self,url):
		self.proxieName = random.choice(self.proxyDict.keys())
		print getYellow("Proxy: ")+getCyan(self.proxieName)
		self.proxie = self.proxyDict[self.proxieName]
		try:
			self.getRqst=requests.get(url,headers=self.nrmlHeaders,proxies=self.proxie, timeout=10)
		except Exception, e:
			print e
			time.sleep(10)
			return self.getRequest(url)
		else:
			if self.getRqst.status_code==200:
				self.rqstErr = 0
				return self.getRqst
			else:
				self.rqstErr+=1
				print getYellow("Hi Dear, Don't worry. May be Server down. Exception in Url: ")+url
				print getRed("Error!!! ")+getBlue("I get Status Code: ")+str(self.getRqst.status_code)
				print getGreen("I am sleeping now for 10 second")
				time.sleep(10)
				return self.getRequest(url)
Here is the image snapshot link https://www.dropbox.com/s/yh2bs7z1mx...error.png?dl=0

after getting the content i parse them and save information into a CSV file and send another request.

And i see also that after 01:40 of 6th July the csv file alos not updated. So it's hanging.
 
Old 07-08-2015, 07:56 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,217

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Why do you think this is a programming issue and not an issue with the proxy, or some other network issue?

Last edited by dugan; 07-08-2015 at 08:03 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Cloud 5: Hybrid cloud center stage, Microsoft cloud in a box, Red Hat CEO talks cloud LXer Syndicated Linux News 0 10-24-2014 09:42 AM
LXer: Cloud 5: Dispelling cloud myths, the cloud security excuse, and the fight for cloud supremacy LXer Syndicated Linux News 0 06-20-2014 04:12 PM
How to close open ports using a python script or a shell script in python ?? apanimesh061 Programming 3 11-20-2011 12:31 AM
Python: How can I add a method to an object at runtime? cantab Programming 8 11-02-2009 12:37 PM
python; retrieving dictionary of ley=value pairs passed into method TheLinuxDuck Programming 5 08-21-2003 11:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration