Closed wlmwng closed 3 years ago
Hi Damian, Thanks for adding praw to setup.py. That's a good point about not hosting the data. I replaced the fields you mentioned with generic strings and removed links that went to Reddit for the old example. If there's anything else, just let me know. Thanks!
Hi Damian, here's the code I used in the demo today:
'reset' ElasticSearch database in terminal
curl -X DELETE "localhost:9200/inca?pretty"
curl -X DELETE "localhost:9200/.credentials?pretty"
curl -X DELETE "localhost:9200/.apps?pretty"
initialize INCA
import os
os.getcwd()
os.chdir('./inca')
from inca import Inca
myinca = Inca() # get an instance of INCA
myinca.database.list_apps() # see which apps already exist
create a reddit app and add credentials
myinca.clients.reddit_create_app()
myinca.clients.reddit_create_credentials(appname='health_convos')
ask PRAW to get Reddit posts
myinca.clients.reddit_posts(app='health_convos', subreddit_name='Netherlands',pseudo_output=True,max_results=1)
check one doc as an example:
myinca.database.doctype_first('reddit_post')
export json file
from pathlib import Path
myinca.importers_exporters.export_json_file(query = 'doctype:"reddit_post"', destination = os.path.join(Path(os.getcwd()).parents[1],'health_convos','inca_export','inca_reddit.json'))
delete all 'reddit_post' docs
myinca.database.delete_doctype('reddit_post')
P.S. no big single commit this time :)