-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_pickle.py
More file actions
47 lines (32 loc) · 762 Bytes
/
test_pickle.py
File metadata and controls
47 lines (32 loc) · 762 Bytes
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
import pickle
from pygithub3 import Github
from pymongo import MongoClient
'''
connection = MongoClient()
db = connection['githubdata_test']
db.drop_collection('users')
collection_user = db['users']
gh = Github(login='githubdata', password='Password123')
seed_users = gh.users.followers.list_following('githubdata')
print len(seed_users.all())
i=0
for user in seed_users.all():
print user.login
strg = pickle.dumps(user)
entry = {'userobj':strg}
print entry
print collection_user.insert(entry)
i+=1
print i
i=0
for user in collection_user.find():
print i
i += 1
usertemp = pickle.loads(user['userobj'])
print usertemp.login
'''
a={"a":1,"b":2,"c":3}
f = open('testpickle','a')
for i in range(0,10):
f.write(pickle.dumps(a))
f.close()