本文整理汇总了Python中DCC.login方法的典型用法代码示例。如果您正苦于以下问题:Python DCC.login方法的具体用法?Python DCC.login怎么用?Python DCC.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCC
的用法示例。
在下文中一共展示了DCC.login方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_cid
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def make_cid(dirpath, CID_coll, htmlfile, outroot):
# Get list of DCC documents from a Word file saved as html
GetUrlWord.get_url_word(dirpath + outroot, dirpath + htmlfile)
# Login to DCC
prod = ['prod', 'production', 'p', ' ']
tes = ['test', 'tes', 't']
checker = False
print("Would you like to log into the production site or the test site?")
print("Valid Inputs are as follows: Production, prod, p, test, t :", end="")
choice = input().lower()
#while loop to continue asking the user for input until a correct input has been entered
while (checker == False):
#Production site login choice
if(choice in prod):
print("You are now logging into the Production version of DocuShare")
s = DCC.login(Site ='Production')
checker = True
#test site login choice
elif(choice in tes):
print("You are now logging into the test VM DocuShare")
s = DCC.login(Site ='Test')
checker = True
#cf.dcc_url + cf.dcc_login
#error message alerting user to enter a valid choice
else:
print("Please enter a valid choice, (P)roduction or (T)est")
choice = input().lower()
json_handlelist = dirpath + outroot + 'bothlist.txt'
json_ssdata = dirpath + outroot + 'CID.txt'
get_cid_ssdata(s, json_handlelist, json_ssdata)
xlfile = dirpath + outroot + 'CID_Analysis.xls'
write_spreadsheet(json_ssdata, xlfile)
json_verlist = dirpath + outroot + 'ver_list.txt'
json_doclist = dirpath + outroot + 'doc_list.txt'
make_handle_lists(json_ssdata, json_doclist, json_verlist)
## Remove the files that are currently located in the collection for the CID
if MyUtil.get_yn('Remove location (not delete) of files from ' + CID_coll[0] +'(Y/N)?: '):
doclist = DCC.list_obj_in_coll(s, CID_coll[0],Print=True,Jwrite=False,Depth='infinity',Type='Doc')
for doc in doclist:
DCC.dcc_remove_doc_from_coll(s, doc, CID_coll[0])
## Add CID files to the collection
fh = open(json_doclist, 'r')
dl = json.load(fh)
fh.close()
if MyUtil.get_yn('Add CID files to ' + CID_coll[0] +' (Y/N)?: '):
DCC.add_docs_2_collections(s, dl, CID_coll)
# Check that the expected docs are in the collection
DCC.check_docs_in_coll(s, dl, CID_coll)
示例2: reviewColls
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def reviewColls():
set = top_level
#creates sets that define the user choice to cover miscellaneous cases
prod = ['prod', 'production', 'p', ' ']
tes = ['test', 'tes', 't']
checker = False
print("Would you like to log into the production site or the test site?")
print("Valid Inputs are as follows: Production, prod, p, test, t :", end="")
choice = input().lower()
#while loop to continue asking the user for input until a correct input has been entered
while (checker == False):
#Production site login choice
if(choice in prod):
print("You are now logging into the Production version of DocuShare")
s = DCC.login(Site ='Production')
checker = True
#test site login choice
elif(choice in tes):
print("You are now logging into the test VM DocuShare")
s = DCC.login(Site ='Test')
checker = True
#cf.dcc_url + cf.dcc_login
#error message alerting user to enter a valid choice
else:
print("Please enter a valid choice, (P)roduction or (T)est")
choice = input().lower()
yes = ['yes', 'y', 'ye']
#creates a new boolean variable to allow user to break from loop
checker1 = False
print("Please enter a collection number that you would like to create a sub-collection under")
#checker1 only true when user enters correct information
while(checker1 == False):
col = input()
parent = 'Collection-' + col
fd = DCC.prop_get(s, parent , InfoSet = 'CollData', Print = True)
print("Please enter the name of this new collection:")
name = input()
# double checks user to make sure that they would like to create this collection
print("Are you sure that you want to create: " + name + " under " + parent)
print("Valid Inputs are as follows: Yes, Y, No, N")
ans = input().lower()
# checks that user input is correct, if the answer is a valid form of yes
# then the collection will be made and the user will break from the loop
if(ans in yes):
print("You are now making a collection named: " + name + " under " + parent )
checker1 = True
createReviewColls(s, parent, set, name)
else:
print("Please re-enter a Collection number and Collection name")
示例3: make_cid
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def make_cid(dirpath, CID_coll, htmlfile, outroot):
# Get list of DCC documents from a Word file saved as html
GetUrlWord.get_url_word(dirpath + outroot, dirpath + htmlfile)
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
json_handlelist = dirpath + outroot + 'bothlist.txt'
json_ssdata = dirpath + outroot + 'CID.txt'
get_cid_ssdata(s, json_handlelist, json_ssdata)
xlfile = dirpath + outroot + 'CID_Analysis.xls'
write_spreadsheet(json_ssdata, xlfile)
json_verlist = dirpath + outroot + 'ver_list.txt'
json_doclist = dirpath + outroot + 'doc_list.txt'
make_handle_lists(json_ssdata, json_doclist, json_verlist)
## Remove the files that are currently located in the collection for the CID
if MyUtil.get_yn('Remove location (not delete) of files from ' + CID_coll[0] +'(Y/N)?: '):
doclist = DCC.list_obj_in_coll(s, CID_coll[0],Print=True,Jwrite=False,Depth='infinity',Type='Doc')
for doc in doclist:
DCC.dcc_remove_doc_from_coll(s, doc, CID_coll[0])
## Add CID files to the collection
fh = open(json_doclist, 'r')
dl = json.load(fh)
fh.close()
if MyUtil.get_yn('Add CID files to ' + CID_coll[0] +' (Y/N)?: '):
DCC.add_docs_2_collections(s, dl, CID_coll)
# Check that the expected docs are in the collection
DCC.check_docs_in_coll(s, dl, CID_coll)
示例4: test_fix_set
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def test_fix_set():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
set = PERM_DEFS.setA
handle = 'Document-27819'
fix_set(s, handle, set)
示例5: test_cache
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def test_cache():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
handle = 'Collection-286'
fname = 'Collection-286_CollData'
[flag, fd] = check_cache_fd_json(s, handle, 'CollData', fname)
print(flag, fd)
示例6: main
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def main():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
while True:
com = input("Enter Command: ")
if com.strip() == '':
print('Exiting')
break
if com.upper() == 'COPY':
copy_object(s)
if com.upper() == 'MOVE':
move_object(s)
示例7: test_tree
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def test_tree():
collhandle = 'Collection-286'
exclude = ['Collection-7337','Document-21244', 'Document-26018']
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
print('excluding:',exclude)
tree = get_tree(s, collhandle, Exclude = exclude)
print_tree(s,tree)
print('\n\n')
for branch in tree:
print(branch+': ',tree[branch])
fl = flat_tree(tree, 'root', [])
print(fl)
示例8: test_tree
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def test_tree():
collhandle = "Collection-286"
exclude = ["Collection-7337", "Document-21244", "Document-26018"]
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
print("excluding:", exclude)
tree = get_tree(s, collhandle, Exclude=exclude)
print_tree(s, tree)
print("\n\n")
for branch in tree:
print(branch + ": ", tree[branch])
fl = flat_tree(tree, "root", [])
print(fl)
示例9: test_bulletin_post
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def test_bulletin_post():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
handle = 'Bulletin-6185'
title = '_DISPOSITION'
description = 'This item is open. MELCO made no reply.'
# description = 'This can be closed with a tracked action'
# description = "The reply doesn't answer directly to the question of the RIX. The reply seems to say that DP04S-A isn't a document to be reviewed. Is DP04S-A a review item of FDRP2? Need more clear reply."
keywords = 'Reviewer Disposition'
create_bb_post(s, title, description, keywords, handle)
title = '_ACTION'
description = 'ACTION: TBD (To Be Determined) after issue is addressed by MELCO.'
# description = 'ACTION: MELCO to study what is the probability of the scenario.'
# description = "ACTION: MELCO to add all the safety related drives to the Table 2.1-1."
keywords = 'Reviewer ACTION'
create_bb_post(s, title, description, keywords, handle)
示例10: checkPerms
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def checkPerms(target, permissions):
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
if 'Collection' in target:
tr = Tree.get_tree(s,target)
Tree.print_tree(s, tr)
docList = Tree.get_flat_tree(tr)
else:
docList = [target]
printCheckCriteria(target, permissions)
passList = []
failList = []
for doc in docList:
checkFlag = True
if 'Document' in doc:
fd = DCC.prop_get(s, doc, InfoSet = 'DocBasic')
fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
print("\n\n*** Document Entry", fd['handle'], "***")
print("DCC Name: \"",fd['title'],"\"",sep="")
print("TMT Document Number: ", fd['tmtnum'])
print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
elif 'Collection' in doc:
fd = DCC.prop_get(s, doc, InfoSet = 'CollData')
fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
print("\n\n*** Collection Entry", fd['handle'], "***")
print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
else:
checkFlag = False
print("\nNot checking permissions on object that is not a Collection or Document):",doc)
if checkFlag:
OkayPerms = []
for perm in sorted(fd["permissions"]["perms"], key = lambda x: x["handle"]):
# Go through each set and create a dictionary of entries that have perms okay
for sets in permissions:
for item,plist in sets.items():
if perm["handle"] == item:
if printCheckPerms(perm,plist) == True:
OkayPerms.append(item)
permFlag = False
for sets in permissions:
testFlag = True
for item in sets:
if not item in OkayPerms:
testFlag = False
if testFlag == True:
permFlag = True
if permFlag == True:
print("*** PERMISSIONS MEET CRITERIA ***")
passList.append(doc)
else:
print("!!! PERMISSIONS DO NOT MEET CRITERIA !!!")
failList.append(doc)
return([passList,failList])
示例11: testTraverse
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def testTraverse():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
coll = 'Collection-286'
create_DCC_mirror(s, coll, '/Users/sroberts/Box Sync/TMT DCC Files/Test/', SaveFiles = True, MaxFileSize = 2000000)
示例12: get_discussion_rowcol
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def get_discussion_rowcol(url, htmlfile, xlfile, ssrow, sscol):
# Login to DCC and save the discussion as an html file
s = DCC.login(CF.dcc_url + CF.dcc_login)
res = s.get(url)
res.raise_for_status()
webfile = open(CF.dccfilepath + htmlfile,'wb')
for chunk in res.iter_content(100000):
webfile.write(chunk)
webfile.close
# Get the HTML into the Beautiful Soup object
dcc=open(CF.dccfilepath + htmlfile,'r',encoding='utf-8').read()
dom = BeautifulSoup(dcc, "html.parser")
# Open the spreadsheet
try:
wb = load_workbook(xlfile)
print('Opened existing file :', xlfile)
existing_doc = True
except:
wb = openpyxl.Workbook()
print('Created new file :', xlfile)
existing_doc = False
ws = wb.worksheets[0]
# Write and format the headings in Excel if this is a new document
set_ss_headings(ws, ssrow, sscol)
# Find the Parent of all the original posts (that may have replies)
# This is <form name="ToolbarMulti" method="post" action="/docushare/dsweb/ProcessMultipleCommand">
form_tag = dom.find("form", {"name":"ToolbarMulti"})
rowoff = ssrow
ssrow = ssrow + 1
# Now find all the children that are Post Entries
for idx, postentry in enumerate(form_tag.find_all("div", class_ = "postentry", recursive = False)):
[title, url, author, auth_url, dt, post] = get_postentry_author_info( postentry )
# post is the text of the original posting.
# Look for replies to posts
# The replyposts class is always the next sibling
replies = postentry.find_next_sibling()
# count the number of replies
times = 0
reps = []
r_dates = [dt]
r_latest = ''
r_title = ''
r_disposition = ''
r_action = ''
for replyentry in replies.find_all("div", class_ = "postentry"):
[r_title, r_url, r_author, r_auth_url, r_dt, r_latest] = get_postentry_author_info( replyentry )
# Put results into a list with line breaks
reps.append(r_author + ': ' + r_dt.strftime('%y-%m-%d %H:%M'))
r_dates.append(r_dt)
if '_DISPOSITION' in r_title.upper():
# print('r_disposition is :', r_latest)
r_disposition = r_latest
if '_ACTION' in r_title.upper():
# print('r_action is :', r_latest)
r_action = r_latest
times += 1
# Turn the reps list into a single string
repstr = ';\n'.join(reps)
# Find the latest modified date
r_dates.sort()
r_date_latest = r_dates[-1]
r_date_latest_str = r_date_latest.strftime('%y-%m-%d %H:%M')
# Print output
print('\nEntry:', idx)
print('title:', title)
print('url:', url)
print('posting:', post)
print('author:', author)
print('date:',dt.strftime('%y-%m-%d %H:%M'))
if repstr != '':
print('latest update:', r_date_latest_str)
print('replies by:', repstr)
print('latest reply title:', r_title)
print('latest reply:', r_latest)
if r_disposition != '':
print('Disposition:',r_disposition)
#.........这里部分代码省略.........
示例13: print
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
# construct document module report list
docmodreport = []
docmodreport.append('dccDocTitle')
docmodreport.append('dccDocNo')
docmodreport.append('dccDocRev')
docmodreport.append('DocType')
docmodreport.append('dccDocHandleHyperlink')
docmodreport.append('dccDocVersionHyperlink')
docmodreport.append('dccDocSignedApproved')
docmodreport.append('TMTPublished')
docmodreport.append('dccStatusCheckDate')
docmodreport.append('WIP-ParentDocumentNo')
docmodreport.append('CRNumbers')
s = DCC.login(CF.dcc_url + CF.dcc_login)
for ref in reflist.items():
print('looking for ', ref[0], ref[1])
for doc in dm.items():
if DocMod.is_in_dict(ref[1],doc[1]):
print('Found Document Module Object #:', doc[0])
DocMod.print_report(docmodreport, doc[1])
# The following code prints all DCC information on the found files
# fd = DCC.prop_get(s, DCC.get_handle(doc[1]['dccDocHandleHyperlink']), InfoSet = 'DocBasic')
# fd['permissions'] = DCC.prop_get(s, DCC.get_handle(doc[1]['dccDocHandleHyperlink']), InfoSet = 'Perms')
# DCC.print_doc_basic(fd)
# DCC.print_perms(fd['permissions'])
示例14:
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
#!/usr/bin/env python3
import Tree
import DCC
# This script can be used to create an html list and a spreadsheet of documents below the
# specified collection. The main use of the code is to create CID lists in html and spreadsheet
# from from a set of collections containing CID files
froot = 'NFIRAOS CID'
coll = 'Collection-10609'
keyword_filter = '' # if no keyword set keyword_filter = ''
# Login to DCC
s = DCC.login(Site = 'Production')
tr = Tree.return_tree(s, coll, froot)
Tree.xls_tree(s,tr,coll,froot, Keyword = keyword_filter)
Tree.html_tree(s,tr,froot, Keyword = keyword_filter)
示例15: main
# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import login [as 别名]
def main():
# Login to DCC
s = DCC.login(CF.dcc_url + CF.dcc_login)
#****** SET Flag for asking about changes ******
ask_flag = MyUtil.get_yn('Ask about changes to files *** BE CAREFUL !!! *** (Y/N)? ')
print()
#****** Choose SET ******
### Safe to run without checking ###
# set = PD.SET_REMOVE_RO_IF_SE_READERSHIP
# set = PD.SET_REMOVE_STR_MANAGERS
# set = PD.SET_REMOVE_INACTIVE
set = PD.SET_PUBLISHED
### Don't Run without checking ###
# set = PD.SET_PERM_NRTCPDR
# set = PD.SET_M1CS_PDR
# set = PD.SET_REMOVE_STR_MANAGERS
# set = PD.SET_SE_READERSHIP
# set = PD.SET_IRIS_REMOVE_MATTHIAS_MANAGE_FALSE
# set = PD.SET_IRIS_REMOVE_ISBRUCKER
# set = PD.SET_REPLACE_IRIS_EAR_WITH_ALL
# set = PD.SET_REMOVE_STR_MANAGERS
# set = PD.SET_REMOVE_UNNEEDED
### IRIS Manager Set with removal of group membership
# set = PD.SET_IRIS_TEAM
# ghs = PERM.get_group_handles(s,PD.grp_IRIS_MANAGE)
# for gh in ghs:
# PD.SET_ADD_IRIS_MANAGER['PermAct'].append(PD.remove_user(gh))
# print(PD.SET_ADD_IRIS_MANAGER['PermAct'])
### IRIS Team Set with removal of group members
# set = PD.SET_IRIS_TEAM
# ghs = PERM.get_group_handles(s,PD.grp_IRIS_team)
# for gh in ghs:
# PD.SET_IRIS_TEAM['PermAct'].append(PD.remove_user_ifperms(gh, PD.manage_false))
# print(PD.SET_IRIS_TEAM['PermAct'])
### M1S Team Set with removal of optics group members
# set = PD.SET_M1S_Suijian
#
# PD.remove_user_if_group(s, set, PD.grp_optics, PD.manage_false)
# PD.remove_user_if_group(s, set, PD.grp_niaotEAR, PD.WM_false)
#
# print(PD.SET_M1S_Suijian['PermAct'])
### CRYO Team Set with removal of optics group members
# set = PD.SET_EMPTY
#
# PD.remove_user_if_group(s, set, PD.grp_CryoTeam, PD.manage_false)
# PD.remove_user_if_group(s, set, PD.grp_CryoManager,PD.read_true)
#
# print(PD.SET_EMPTY['PermAct'])
#****** Choose Collection ******
# m1cs_pdr_root = 'Collection-10725'
# m1cs_pdr_presentation = 'Collection-10821'
# handle = m1cs_pdr_presentation
# config_control = 'Collection-8277'
# handle = config_control
IRIS_science = 'Collection-7542'
IRIS = 'Collection-2463'
Change_control = 'Collection-399'
SE_access_handling = 'Collection-2949'
SE_interface_control = 'Collection-195'
SE_budgets = 'Collection-309'
Published = 'Collection-8277'
IRIS_LPDR = 'Collection-11161'
NRTC_PDR = 'Collection-10045'
M1S_suijian_coll = 'Collection-5678'
CRYO_coll = 'Collection-9141'
LGSF_IOE = 'Collection-4956'
ENC_Construction_Phase = 'Collection-10598'
Test = 'Document-27819'
# set = PD.SET_ENC_CONSTRUCTION
# set = PD.SET_REMOVE_RO_IF_SE_READERSHIP
# handle = ENC_Construction_Phase
# handle = Test
handle = Published
#******!!! Run !!! ******
# print(set)
tr = Tree.return_tree(s, handle, 'Tree_' + handle)
handles = Tree.get_flat_tree(tr)
PERM.check_perms(s, set, handles, Ask = ask_flag)