Skip to content

Commit

Permalink
Merge pull request #658 from l-vincent-l/fixes_python3
Browse files Browse the repository at this point in the history
Fixes python3
  • Loading branch information
l-vincent-l committed Nov 5, 2018
2 parents bc5f36d + 424cd10 commit dec73fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion APITaxi/api/hail.py
Expand Up @@ -218,7 +218,7 @@ def get(self, hail_id):
if not hlog:
return {"data": []}
return {"data":[
{k: v for k,v in chain(iter(json.loads(value).items()), [('datetime', score)])}
{k: v for k,v in chain(iter(json.loads(value.decode('utf-8')).items()), [('datetime', score)])}
for value, score in hlog
]
}
2 changes: 1 addition & 1 deletion APITaxi/api/taxi.py
Expand Up @@ -135,7 +135,7 @@ def filter_zone(self, taxi, p):
def set_not_available(self, lon, lat, name_redis, radius):
store_key = name_redis+'_operateur'
g.keys_to_delete.append(store_key)
redis_store.georadius(current_app.config['REDIS_GEOINDEX'], lat, lon, radius, 'm',
redis_store.georadius(current_app.config['REDIS_GEOINDEX'], lon, lat, radius, 'm',
store_dist=store_key)
redis_store.zinterstore(store_key, [store_key,
current_app.config['REDIS_TIMESTAMPS'],
Expand Down
3 changes: 3 additions & 0 deletions APITaxi/tasks/make_views.py
Expand Up @@ -24,6 +24,7 @@ def get_taxis_ids_operators(frequency):
for gen_taxi_ids_operator in pager(redis_store.zrangebyscore(
current_app.config['REDIS_TIMESTAMPS'], bound, time()), page_size=100):
yield list(gen_taxi_ids_operator)
yield list([t.decode('utf-8') for t in gen_taxi_ids_operator])
else:
taxis = []
for g_keys in pager(redis_store.keys("taxi:*"), page_size=100):
Expand All @@ -35,6 +36,8 @@ def get_taxis_ids_operators(frequency):
for operator, taxi in v.items():
if float(taxi.split(" ")[0]) >= bound:
taxis.append("{}:{}".format(k[5:], operator))
taxi_id_operator = "{}:{}".format(k[5:].decode('utf-8'), operator)
taxis.append(taxi_id_operator.decode('utf-8'))
if len(taxis) >= 100:
yield taxis
taxis = []
Expand Down
2 changes: 0 additions & 2 deletions APITaxi/tasks/send_request_operator.py
Expand Up @@ -10,8 +10,6 @@
@celery.task()
def send_request_operator(hail_id, endpoint, operator_header_name,
operator_api_key, operator_email):
operator_api_key = operator_api_key.encode('utf-8')
operator_header_name = operator_header_name.encode('utf-8')
hail = Hail.query.get(hail_id)
if not hail:
current_app.logger.error('Unable to find hail: {}'.format(hail_id))
Expand Down

0 comments on commit dec73fc

Please sign in to comment.