Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert resumePVList.py to python3 #317

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions docs/docs/source/samples/resumePVList.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#!/usr/bin/env python
#!/usr/bin/env python3
'''Given a list of PVs, this resumes all the PVs in that list'''

import os
import sys
import argparse
import time
import urllib
import urllib2
import requests
import json
import datetime
import time

def resumePVs(bplURL, pvNames):
'''Resumes the pvs specified by list pvNames'''
url = bplURL + '/resumeArchivingPV'
req = urllib2.Request(url)
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(pvNames))
the_page = response.read()
resumePVResponse = json.loads(the_page)
response = requests.post(url, json=pvNames)
response.raise_for_status()
resumePVResponse = response.json()
return resumePVResponse


Expand All @@ -37,4 +34,4 @@ def resumePVs(bplURL, pvNames):

resumeResponse = resumePVs(args.url, pvNames)
for pvResponse in resumeResponse:
print "{0} => {1}".format(pvResponse['pvName'], pvResponse['status'] if 'status' in pvResponse else pvResponse['validation'])
print("{0} => {1}".format(pvResponse['pvName'], pvResponse['status'] if 'status' in pvResponse else pvResponse['validation']))
Loading