4IyqA2qaONYkpyUQDKLHxR changeset

Changeset636437353763 (b)
Parent663737326139 (a)
ab
0-import _midgard as midgard
0-
0-# Set up the repository config
0-configuration = midgard.config()
0-configuration.dbtype = 'SQLite'
0-configuration.database = 'midgardexample'
0-# this will store to SQLite in ~/.midgard2/data/midgardexample.db
0-
0-# Open a Midgard repository connection
0-connection = midgard.connection()
0-connection.open_config(configuration)
0-
0-import urllib, urllib2
0-import simplejson as json
0-
0-class QaikuUser():
0-    user = None
0-
0-    def __init__(self, username):
0-        try:
0-            self.user = midgard.db.user({'login': username, 'authtype': 'APIkey'})
0-        except:
0-            self.user = midgard.db.user()
0-            self.user.login = username
0-            self.user.authtype = 'APIkey'
0-            self.user.active = True
0-            self.user.create()
0-       
0-        if (self.user.password is None):
0-            self.ask_password()
0-
0-        self.user.log_in()
0-   
0-    def ask_password(self):
0-        password = raw_input('Please type your Qaiku API key: ')
0-       
0-        if (self.check_password(password) is False):
0-            self.ask_password()
0-           
0-        self.user.password = password
0-        self.user.update()
0-           
0-    def check_password(self, password):
0-        opener = urllib2.build_opener()
0-        opener.addheaders = [('User-agent', 'adventure_tablet/0.1')]
0-        try:
0-            params = urllib.urlencode({'apikey': password})
0-            url = 'http://www.qaiku.com/api/statuses/user_timeline.json?%s' % params
0-            req = opener.open(url)
0-        except urllib2.HTTPError, e:
0-            print('Sorry, authorization failed.')
0-            return False
0-        except urllib2.URLError, e:
0-            print("Connection failed, error %s. Try again later" % (e.message))
0-            return False
0-
0-        return True       
0-   
0-# Match OS user to Midgard user
0-import getpass
0-username = getpass.getuser()
0- 
0-user = QaikuUser(username)
0-print "Can has Qaiku"
0+a295Um  <a href="http://gvtrnlssoosx.com/">gvtrnlssoosx</a>, [url=http://uheimydwivdj.com/]uheimydwivdj[/url], [link=http://fjvesiwpyfvf.com/]fjvesiwpyfvf[/link], http://ebocyjfbxkrp.com/
...
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
57
58
59
60
61
62
63
64
65
66
67
68
--- Revision 663737326139
+++ Revision 636437353763
@@ -1,64 +1,1 @@
-import _midgard as midgard
-
-# Set up the repository config
-configuration = midgard.config()
-configuration.dbtype = 'SQLite'
-configuration.database = 'midgardexample'
-# this will store to SQLite in ~/.midgard2/data/midgardexample.db
-
-# Open a Midgard repository connection
-connection = midgard.connection()
-connection.open_config(configuration)
-
-import urllib, urllib2
-import simplejson as json
-
-class QaikuUser():
- user = None
-
- def __init__(self, username):
- try:
- self.user = midgard.db.user({'login': username, 'authtype': 'APIkey'})
- except:
- self.user = midgard.db.user()
- self.user.login = username
- self.user.authtype = 'APIkey'
- self.user.active = True
- self.user.create()
-
- if (self.user.password is None):
- self.ask_password()
-
- self.user.log_in()
-
- def ask_password(self):
- password = raw_input('Please type your Qaiku API key: ')
-
- if (self.check_password(password) is False):
- self.ask_password()
-
- self.user.password = password
- self.user.update()
-
- def check_password(self, password):
- opener = urllib2.build_opener()
- opener.addheaders = [('User-agent', 'adventure_tablet/0.1')]
- try:
- params = urllib.urlencode({'apikey': password})
- url = 'http://www.qaiku.com/api/statuses/user_timeline.json?%s' % params
- req = opener.open(url)
- except urllib2.HTTPError, e:
- print('Sorry, authorization failed.')
- return False
- except urllib2.URLError, e:
- print("Connection failed, error %s. Try again later" % (e.message))
- return False
-
- return True
-
-# Match OS user to Midgard user
-import getpass
-username = getpass.getuser()
-
-user = QaikuUser(username)
-print "Can has Qaiku"
+a295Um <a href="http://gvtrnlssoosx.com/">gvtrnlssoosx</a>, [url=http://uheimydwivdj.com/]uheimydwivdj[/url], [link=http://fjvesiwpyfvf.com/]fjvesiwpyfvf[/link], http://ebocyjfbxkrp.com/