|
4 | 4 | from __future__ import (absolute_import, division,
|
5 | 5 | print_function, unicode_literals)
|
6 | 6 |
|
7 |
| -import copy |
8 |
| -import math |
9 |
| -import sys |
10 |
| -import time |
11 |
| -from collections import namedtuple |
12 |
| -import requests |
13 | 7 | import json
|
| 8 | +import requests |
14 | 9 |
|
15 | 10 |
|
16 | 11 | class Loklak(object):
|
@@ -66,17 +61,17 @@ def geocode(self, places=None):
|
66 | 61 | return_to_user = {}
|
67 | 62 | return json.dumps(return_to_user)
|
68 | 63 |
|
69 |
| - def map(self, latitude, longitude, width=500, height=500, zoom=8, text=""): |
70 |
| - """Returns a map of size 500x500""" |
71 |
| - map_application = 'vis/map.png' |
72 |
| - params = {'text': text, 'mlat': latitude, 'mlon': longitude,\ |
73 |
| - 'width': width, 'height': height, 'zoom': zoom} |
74 |
| - return_to_user = requests.get(self.baseUrl + map_application, \ |
75 |
| - params=params, stream=True) |
76 |
| - if return_to_user.status_code == 200: |
77 |
| - return return_to_user.raw.read() |
78 |
| - else: |
79 |
| - return '' |
| 64 | + def get_map(self, latitude, longitude, width=500, height=500, zoom=8, text=""): |
| 65 | + """Returns a map of size 500x500""" |
| 66 | + map_application = 'vis/map.png' |
| 67 | + params = {'text': text, 'mlat': latitude, 'mlon': longitude,\ |
| 68 | + 'width': width, 'height': height, 'zoom': zoom} |
| 69 | + return_to_user = requests.get(self.baseUrl + map_application, \ |
| 70 | + params=params, stream=True) |
| 71 | + if return_to_user.status_code == 200: |
| 72 | + return return_to_user.raw.read() |
| 73 | + else: |
| 74 | + return '' |
80 | 75 |
|
81 | 76 | def peers(self):
|
82 | 77 | """Gives the peers of a user"""
|
@@ -118,8 +113,8 @@ def user(self, name=None, followers=None, following=None):
|
118 | 113 |
|
119 | 114 | def settings(self):
|
120 | 115 | """Gives the settings of the application"""
|
121 |
| - settings_application = 'settings.json' |
122 |
| - url_to_give = 'http://localhost:9000/api/'+settings_application |
| 116 | + settings_application = 'api/settings.json' |
| 117 | + url_to_give = self.baseUrl + settings_application |
123 | 118 | return_to_user = requests.get(url_to_give)
|
124 | 119 | if return_to_user.status_code == 200:
|
125 | 120 | return return_to_user.json()
|
@@ -181,7 +176,7 @@ def aggregations(self, query=None, since=None, until=None, fields=None, limit=No
|
181 | 176 | params['fields'] = field_string
|
182 | 177 | if limit:
|
183 | 178 | params['limit'] = self.limit
|
184 |
| - if limit == None: |
| 179 | + if limit is None: |
185 | 180 | limit = 6
|
186 | 181 | params['limit'] = self.limit
|
187 | 182 | params['count'] = 0
|
|
0 commit comments