SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>>from bitbucket.bitbucket import Bitbucket
  2. >>>USERNAME = 'CCC'
  3. >>>PASSWORD = 'BBB'    
  4. >>>bb = Bitbucket(USERNAME, PASSWORD, repo_name_or_slug="Py-Bitbucket-api")
  5. >>>success, result = bb.repository.get()
  6. >>>print (bb.repository.get())
  7. True{......}
  8. >>>success, archive_path = bb.repository.archive()
  9. >>> print (success, archive_path)
  10. True C:....Temptmp_zxpa_14
  11.    
  12. # Access a public repository
  13. bb = Bitbucket(USERNAME, repo_name_or_slug="public_repository")
  14. # Access a private repository
  15. bb = Bitbucket(USERNAME, PASSWORD, repo_name_or_slug="private_repository")
  16.  
  17. # Download a repository as an archive
  18. success, archive_path = bb.repository.archive()
  19.    
  20. bitbucketUrl="http://localhost:7990/"
  21. # bitbucketUrl="http://bitbucket.rd.800best.com/projects/EXPRESS/repos/q9taobao/browse"
  22. USERNAME=""
  23. OAUTH_ACCESS_TOKEN=""
  24. OAUTH_ACCESS_TOKEN_SECRET=""
  25. CONSUMER_SECRET=""
  26. CONSUMER_KEY=""
  27. bb=Bitbucket(USERNAME)
  28. if not OAUTH_ACCESS_TOKEN and not OAUTH_ACCESS_TOKEN_SECRET:
  29.     bb.authorize(CONSUMER_KEY,CONSUMER_SECRET,"http://localhost:7990/")
  30.     webbrowser.open(bb.url('AUTHENTICATE',token=bb.access_token))
  31.     oahtu_verifier=raw_input('Enter Verifier from url [oauth_verifier]')
  32.     bb.verify(oauth_verifier)
  33.     OAUTH_ACCESS_TOKEN=bb.access_token
  34.     OAUTH_ACCESS_TOKEN_SECRET=bb.OAUTH_ACCESS_TOKEN_SECRET
  35. else:
  36.     bb.authorize(CONSUMER_KEY,CONSUMER_SECRET,'http://localhost:7990/',OAUTH_ACCESS_TOKEN,OAUTH_ACCESS_TOKEN_SECRET)
  37. it redirect to "https://bitbucket.org/account/signin/?next=/site/oauth1/authorize%3Foauth_token%3DNone"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top