[DEBUG] correct server down when to low activity
This commit is contained in:
parent
adbb307895
commit
bbc619ef84
@ -10,6 +10,7 @@ import urllib, urllib2
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import time
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -99,9 +100,19 @@ data = urllib.urlencode({'REPO':args.repo,
|
||||
'TAG':args.tag,
|
||||
'STATUS':args.status,
|
||||
'ID':args.id})
|
||||
# I do this because my server is sometime down and need time to restart (return 408)
|
||||
send_done = 5
|
||||
while send_done >= 0:
|
||||
send_done = send_done - 1
|
||||
try:
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
send_done = -1
|
||||
except urllib2.HTTPError:
|
||||
print("An error occured (maybe on server or network ... 'urllib2.HTTPError: HTTP Error 408: Request Timeout' ")
|
||||
if send_done >= 0:
|
||||
time.sleep(5)
|
||||
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
#print(response.geturl())
|
||||
#print(response.info())
|
||||
return_data = response.read()
|
||||
|
@ -10,6 +10,7 @@ import urllib, urllib2
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import time
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -104,9 +105,18 @@ data = urllib.urlencode({'REPO':args.repo,
|
||||
'SHA1':args.sha1,
|
||||
'LIB_BRANCH':args.branch,
|
||||
'JSON_FILE':json_data})
|
||||
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
# I do this because my server is sometime down and need time to restart (return 408)
|
||||
send_done = 5
|
||||
while send_done >= 0:
|
||||
send_done = send_done - 1
|
||||
try:
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
send_done = -1
|
||||
except urllib2.HTTPError:
|
||||
print("An error occured (maybe on server or network ... 'urllib2.HTTPError: HTTP Error 408: Request Timeout' ")
|
||||
if send_done >= 0:
|
||||
time.sleep(5)
|
||||
#print response.geturl()
|
||||
#print response.info()
|
||||
return_data = response.read()
|
||||
|
16
test_send.py
16
test_send.py
@ -10,6 +10,7 @@ import urllib, urllib2
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import time
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -170,9 +171,18 @@ data = urllib.urlencode({'REPO':args.repo,
|
||||
'SHA1':args.sha1,
|
||||
'JSON_FILE':json_data,
|
||||
'LIB_BRANCH':args.branch})
|
||||
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
# I do this because my server is sometime down and need time to restart (return 408)
|
||||
send_done = 5
|
||||
while send_done >= 0:
|
||||
send_done = send_done - 1
|
||||
try:
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
send_done = -1
|
||||
except urllib2.HTTPError:
|
||||
print("An error occured (maybe on server or network ... 'urllib2.HTTPError: HTTP Error 408: Request Timeout' ")
|
||||
if send_done >= 0:
|
||||
time.sleep(5)
|
||||
#print response.geturl()
|
||||
#print response.info()
|
||||
return_data = response.read()
|
||||
|
@ -11,6 +11,7 @@ import sys
|
||||
import os
|
||||
import argparse
|
||||
import fnmatch
|
||||
import time
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -184,9 +185,18 @@ data = urllib.urlencode({'REPO':args.repo,
|
||||
'SHA1':args.sha1,
|
||||
'LIB_BRANCH':args.branch,
|
||||
'JSON_FILE':json_data})
|
||||
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
# I do this because my server is sometime down and need time to restart (return 408)
|
||||
send_done = 5
|
||||
while send_done >= 0:
|
||||
send_done = send_done - 1
|
||||
try:
|
||||
req = urllib2.Request(args.url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
send_done = -1
|
||||
except urllib2.HTTPError:
|
||||
print("An error occured (maybe on server or network ... 'urllib2.HTTPError: HTTP Error 408: Request Timeout' ")
|
||||
if send_done >= 0:
|
||||
time.sleep(5)
|
||||
#print response.geturl()
|
||||
#print response.info()
|
||||
return_data = response.read()
|
||||
|
Loading…
x
Reference in New Issue
Block a user