예제 #1
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''
__author__ = 'Jacob Bieker'
import json
import os
from glob import glob

from insights.io import config

if __name__ != "__main__":
    configuration_files = config.import_yaml_files(".", ["constants"])
    constants = configuration_files[0]
else:
    configuration_files = config.import_yaml_files("..", ["constants"])
    constants = configuration_files[0]

rootdir = os.path.join(constants.get("dataDir"), "Takeout", "Google Photos")
photo_data = [
    y for x in os.walk(rootdir) for y in glob(os.path.join(x[0], '*.json'))
]

print("Starting Google Photo Parsing")
for json_file in photo_data:
    with open(json_file, 'r') as file:
        metadata = json.dump(file)
예제 #2
0
            elif type_query == "Database":
                location_bulk_insert_queries.append(response)
                insert_many_locations(location_bulk_insert_queries)
            print("Found match in Dictionary")
            return True
        else:
            return False
    except KeyError:
        print("Key Error: Not found in Dictionary")
        return False


from insights.io import config

if __name__ != "__main__":
    configuration_files = config.import_yaml_files(".", ["constants", "keys", "countries.yaml"])
    constants = configuration_files[0]
    key_file = configuration_files[1]
    location_data = configuration_files[2]
else:
    configuration_files = config.import_yaml_files("..", ["constants", "keys", "countries.yaml"])
    constants = configuration_files[0]
    key_file = configuration_files[1]
    location_data = configuration_files[2]

rootdir = os.path.join(constants.get('dataDir'), "Takeout", "Location History")
opencage_geolocator = OpenCage(api_key=str(key_file.get('opencage').get('key')))
google_geolocator = GoogleV3()
nominatim_geolocator = Nominatim()

if can_load_last_position():
예제 #3
0
def test_load_files():
    config_output = config.import_yaml_files(
        ".", ["dbconfig.yaml", "countries.yaml", "access.yaml"])
    assert config_output != []
예제 #4
0
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''
__author__ = 'Jacob'
'''
Unlike Takeout scripts, this deals with live data, as there is no known download-your-data from Twitter
'''
import tweepy

# Authentication with Twitter
from insights.io import config

if __name__ != "__main__":
    configuration_files = config.import_yaml_files(".", ["access.yaml"])
    access_config = configuration_files[0]
else:
    configuration_files = config.import_yaml_files("..", ["access.yaml"])
    access_config = configuration_files[0]

auth = tweepy.OAuthHandler(
    access_config.get('twitter').get('key'),
    access_config.get('twitter').get('secret'))

#Redirect user to authenticate with Twitter before continuing
try:
    redirect_url = auth.get_authorization_url()
except tweepy.TweepError:
    print('Error! Failed to get request token.')