Skip to content

Commit ac8b231

Browse files
committed
4.6.1
Delete windows line separator
1 parent 9393b73 commit ac8b231

7 files changed

Lines changed: 436 additions & 426 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ upload_to_PyPi.py
66
.project
77
.pydevproject
88
.settings/
9+
.idea/

MANIFEST

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ jconfig\jconfig.py
55
test\test.py
66
vk_api\__init__.py
77
vk_api\vk_api.py
8-
vk_api\upload\__init__.py
9-
vk_api\upload\vk_upload.py
8+
vk_api\vk_upload.py

example.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
'''
2-
@author: Kirill Python
3-
@contact: http://vk.com/python273
4-
@license Apache License, Version 2.0, see LICENSE file
5-
6-
Copyright (C) 2013
7-
'''
8-
9-
# -*- coding: utf-8 -*-
10-
import vk_api
11-
12-
13-
def main():
14-
u""" Пример получения последнего сообщения со стены """
15-
16-
login = u'python@vk.com'
17-
password = u'mypassword'
18-
19-
try:
20-
vk = vk_api.VkApi(login, password) # Авторизируемся
21-
except vk_api.authorization_error as error_msg:
22-
print(error_msg) # В случае ошибки выведем сообщение
23-
return # и выйдем
24-
25-
values = {
26-
'count': 1 # Получаем только одно сообщение
27-
}
28-
response = vk.method('wall.get', values) # Используем метод wall.get
29-
print(response[1]['text']) # Печатаем текст последнего поста со стены
30-
31-
if __name__ == '__main__':
32-
main()
1+
'''
2+
@author: Kirill Python
3+
@contact: http://vk.com/python273
4+
@license Apache License, Version 2.0, see LICENSE file
5+
6+
Copyright (C) 2013
7+
'''
8+
9+
# -*- coding: utf-8 -*-
10+
import vk_api
11+
12+
13+
def main():
14+
u""" Пример получения последнего сообщения со стены """
15+
16+
login = u'python@vk.com'
17+
password = u'mypassword'
18+
19+
try:
20+
vk = vk_api.VkApi(login, password) # Авторизируемся
21+
except vk_api.authorization_error as error_msg:
22+
print(error_msg) # В случае ошибки выведем сообщение
23+
return # и выйдем
24+
25+
values = {
26+
'count': 1 # Получаем только одно сообщение
27+
}
28+
response = vk.method('wall.get', values) # Используем метод wall.get
29+
print(response[1]['text']) # Печатаем текст последнего поста со стены
30+
31+
if __name__ == '__main__':
32+
main()

jconfig/__init__.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
'''
2-
@author: Kirill Python
3-
@contact: http://vk.com/python273
4-
@license Apache License, Version 2.0, see LICENSE file
5-
6-
Copyright (C) 2013
7-
'''
8-
9-
__author__ = "Kirill Python"
10-
__version__ = "1.1"
11-
__email__ = "mikeking568@gmail.com"
12-
__contact__ = "https://vk.com/python273"
13-
14-
15-
import sys
16-
if sys.version_info[0] == 2:
17-
from jconfig import *
18-
else:
19-
from .jconfig import *
1+
'''
2+
@author: Kirill Python
3+
@contact: http://vk.com/python273
4+
@license Apache License, Version 2.0, see LICENSE file
5+
6+
Copyright (C) 2013
7+
'''
8+
9+
__author__ = "Kirill Python"
10+
__version__ = "1.1"
11+
__email__ = "mikeking568@gmail.com"
12+
__contact__ = "https://vk.com/python273"
13+
14+
15+
import sys
16+
if sys.version_info[0] == 2:
17+
from jconfig import *
18+
else:
19+
from .jconfig import *

jconfig/jconfig.py

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
'''
2-
@author: Kirill Python
3-
@contact: http://vk.com/python273
4-
@license Apache License, Version 2.0, see LICENSE file
5-
6-
Copyright (C) 2013
7-
'''
8-
9-
# -*- coding: utf-8 -*-
10-
import os
11-
import json
12-
13-
14-
class config:
15-
def __init__(self, section, filename='config'):
16-
self.section = section # Секция настроек
17-
self.filename = filename # Файл с настройками
18-
self.all = self.parse() # Все настройки
19-
self.settings = self.all.get(section, {}) # Настройки секции
20-
21-
def __getitem__(self, item):
22-
return self.settings.get(item, {})
23-
24-
def __setitem__(self, key, value):
25-
self.settings.update({key: value})
26-
self.all.update({self.section: self.settings})
27-
self.update(self.all)
28-
29-
def parse(self):
30-
fileis = os.path.exists(self.filename)
31-
if fileis:
32-
settings = json.load(open(self.filename, 'r'))
33-
return settings
34-
else:
35-
self.update()
36-
return {}
37-
38-
def update(self, settings=None):
39-
if not settings:
40-
settings = {}
41-
42-
json.dump(settings, open(self.filename, 'w'))
1+
'''
2+
@author: Kirill Python
3+
@contact: http://vk.com/python273
4+
@license Apache License, Version 2.0, see LICENSE file
5+
6+
Copyright (C) 2013
7+
'''
8+
9+
# -*- coding: utf-8 -*-
10+
import os
11+
import json
12+
13+
14+
class config(object):
15+
def __init__(self, section, filename='config'):
16+
self.section = section # Секция настроек
17+
self.filename = filename # Файл с настройками
18+
self.all = self.parse() # Все настройки
19+
self.settings = self.all.get(section, {}) # Настройки секции
20+
21+
def __getitem__(self, item):
22+
return self.settings.get(item, {})
23+
24+
def __setitem__(self, key, value):
25+
self.settings.update({key: value})
26+
self.all.update({self.section: self.settings})
27+
self.update(self.all)
28+
29+
def parse(self):
30+
fileis = os.path.exists(self.filename)
31+
if fileis:
32+
settings = json.load(open(self.filename, 'r'))
33+
return settings
34+
else:
35+
self.update()
36+
return {}
37+
38+
def update(self, settings=None):
39+
if not settings:
40+
settings = {}
41+
42+
json.dump(settings, open(self.filename, 'w'))

0 commit comments

Comments
 (0)