Guest User

Untitled

a guest
Jul 2nd, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. In [1]: from github import Github
  2.  
  3. In [2]: g = Github('oauthtoken')
  4.  
  5. In [3]: salt_repo = g.get_repo('saltstack/salt')
  6.  
  7. In [4]: salt_repo_issues = salt_repo.get_issues()
  8.  
  9. In [5]: import pymysql.cursors
  10.  
  11. In [6]: connection = pymysql.connect(host='localhost', user='root', password='Saltstack22', db='db', charset='utf8mb4', curs
  12. ...: orclass=pymysql.cursors.DictCursor)
  13.  
  14. In [7]: try:
  15. ...: with connection.cursor() as cursor:
  16. ...: for issue in salt_repo_issues:
  17. ...: sql = "INSERT INTO `trial_salt_issues_3`(`title`, `created_at`, `updated_at`, `closed_at`) VALUES (%s, %s, %s, %s)"
  18. ...: cursor.execute(sql, (issue.title, issue.created_at, issue.updated_at, issue.closed_at))
  19. ...: connection.commit()
  20. ...: finally:
  21. ...: connection.close()
Add Comment
Please, Sign In to add comment