Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. from cloudant.client import Cloudant
  2. import json
  3.  
  4. username = "<cloudant_username>"
  5. password = "<cloudant_password>"
  6. cloudantURL = "<cloudant_url>"
  7. client = Cloudant(username, password, url=cloudantURL)
  8.  
  9. document_id = '<cloudant_document_id>'
  10.  
  11. def GetNews():
  12. client.connect()
  13. my_database = client['newssentiment']
  14. # document_id
  15. news = my_database[document_id]
  16. client.disconnect()
  17. # json to string
  18. news = json.dumps(news)
  19. return news;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement