Skip to content

Commit

Permalink
cleaned master
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondlin1 committed May 13, 2020
1 parent b532bc4 commit dd493bd
Show file tree
Hide file tree
Showing 26 changed files with 7,316 additions and 1,053 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
config.py
*/node_modules/
libinfo-scraper/
!libinfo-scraper/__pycache__
!libinfo-scraper/easy_install.py
!libinfo-scraper/libinfo-scraper.py
56 changes: 56 additions & 0 deletions busyness/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from .crawler import run
from .crawler import get_populartimes

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

"""
ENTRY POINT
"""


def get(api_key, types, p1, p2, n_threads=20, radius=180, all_places=False):
"""
:param api_key: str; api key from google places web service
:param types: [str]; placetypes
:param p1: (float, float); lat/lng of the south-west delimiting point
:param p2: (float, float); lat/lng of the north-east delimiting point
:param n_threads: int; number of threads to use
:param radius: int; meters;
:param all_places: bool; include/exclude places without populartimes
:return: see readme
"""
params = {
"API_key": api_key,
"radius": radius,
"type": types,
"n_threads": n_threads,
"all_places": all_places,
"bounds": {
"lower": {
"lat": min(p1[0], p2[0]),
"lng": min(p1[1], p2[1])
},
"upper": {
"lat": max(p1[0], p2[0]),
"lng": max(p1[1], p2[1])
}
}
}

return run(params)


def get_id(api_key, place_id):
"""
retrieves the current popularity for a given place
:param api_key:
:param place_id:
:return: see readme
"""
return get_populartimes(api_key, place_id)
Binary file added busyness/__pycache__/crawler.cpython-37.pyc
Binary file not shown.
Loading

0 comments on commit dd493bd

Please sign in to comment.