-
Notifications
You must be signed in to change notification settings - Fork 1
/
dummy_context_init.py
59 lines (45 loc) · 2.07 KB
/
dummy_context_init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import json
import os
import xmlrpc.client
SERVING_HOST = str(os.getenv("CONTEXT_RPC_HOST"))
SERVING_PORT = int(os.getenv("CONTEXT_RPC_PORT"))
url="http://{}:{}".format("localhost",6061)
context = xmlrpc.client.ServerProxy(url)
# SERVING_HOST = str(os.getenv("EXTRACTOR_WORKER_HOST"))
# SERVING_PORT = int(os.getenv("EXTRACTOR_WORKER_PORT"))
# url="http://{}:{}".format(SERVING_HOST,SERVING_PORT)
# worker = xmlrpc.client.ServerProxy(url)
# # Print list of available methods
# print(context.system.listMethods())
creds_0 = {"TWEET_CONSUM":str(os.getenv("TWEET_CONSUM")),
"TWEET_SECRET":str(os.getenv("TWEET_SECRET")),
"TWEET_KEY":str(os.getenv("TWEET_KEY")),
"TWEET_ACCESS_SECRET":str(os.getenv("TWEET_ACCESS_SECRET"))}
creds_1 = {"TWEET_CONSUM":str(os.getenv("TWEET_CONSUM1")),
"TWEET_SECRET":str(os.getenv("TWEET_SECRET1")),
"TWEET_KEY":str(os.getenv("TWEET_KEY1")),
"TWEET_ACCESS_SECRET":str(os.getenv("TWEET_ACCESS_SECRET1"))
}
creds_2 = {"TWEET_CONSUM":str(os.getenv("TWEET_CONSUM2")),
"TWEET_SECRET":str(os.getenv("TWEET_SECRET2")),
"TWEET_KEY":str(os.getenv("TWEET_KEY2")),
"TWEET_ACCESS_SECRET":str(os.getenv("TWEET_ACCESS_SECRET2"))
}
creds_3 = {"TWEET_CONSUM":str(os.getenv("TWEET_CONSUM3")),
"TWEET_SECRET":str(os.getenv("TWEET_SECRET3")),
"TWEET_KEY":str(os.getenv("TWEET_KEY3")),
"TWEET_ACCESS_SECRET":str(os.getenv("TWEET_ACCESS_SECRET3"))
}
creds_0 = json.dumps(creds_0)
creds_1 = json.dumps(creds_1)
creds_2 = json.dumps(creds_2)
creds_3 = json.dumps(creds_3)
print(context.get("TwitterCredentials"))
# # context.set("TwitterCredentials",creds_1)
# context.set("TwitterCredentials",creds_2)
# # context.set("TwitterCredentials",creds_3)
# context.set("Twitter_User_ID","1192946702891790336") # Abd Elmadjid Tebboune
# context.set("Follower_Count_Limit","200")
# context.set("Friend_Count_Limit","200")
# print(context.get("Twitter_User_ID"))
# worker.start_harvesting_data("Twitter-service1",{"user":["id"]})