tmp.py 692 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. # %% jira
  3. import codecs
  4. from jira import JIRA
  5. jira = JIRA('http://oa.wanpinghui.com', auth=('郑毅', 'GraphQL6'))
  6. issue = jira.issue('XXH-353')
  7. filename = './test.csv'
  8. def write_bom():
  9. with open(filename, 'w') as f: # create a new file,overwrite when the file was existed
  10. f.write(codecs.BOM_UTF8) # write utf8 BOM at starts of the file
  11. def write_line(*args):
  12. raw = ','.join(args).encode('utf-8') # append a line of content into the file
  13. with open(filename, 'a') as f:
  14. f.write('%s\n' % raw)
  15. write_bom()
  16. for i in range(5):
  17. write_line(issue.fields.project.key, issue.fields.issuetype.name, issue.fields.reporter.displayName)