Esempio n. 1
0
 def __init__(self, access_token=''):
     self.Account = Account(access_token=access_token)
     self.Apps = Apps(access_token=access_token)
     self.Audio = Audio(access_token=access_token)
     self.Auth = Auth(access_token=access_token)
     self.Board = Board(access_token=access_token)
     self.Database = Database(access_token=access_token)
     self.Docs = Docs(access_token=access_token)
     self.Other = Other(access_token=access_token)
     self.Fave = Fave(access_token=access_token)
     self.Friends = Friends(access_token=access_token)
     self.Gifts = Gifts(access_token=access_token)
     self.Groups = Groups(access_token=access_token)
     self.Likes = Likes(access_token=access_token)
     self.Market = Market(access_token=access_token)
     self.Messages = Messages(access_token=access_token)
     self.Newsfeed = Newsfeed(access_token=access_token)
     self.Notes = Notes(access_token=access_token)
     self.Notifications = Notifications(access_token=access_token)
     self.Pages = Pages(access_token=access_token)
     self.Photos = Photos(access_token=access_token)
     self.Places = Places(access_token=access_token)
     self.Polls = Polls(access_token=access_token)
     self.Search = Search(access_token=access_token)
     self.Stats = Stats(access_token=access_token)
     self.Status = Status(access_token=access_token)
     self.Storage = Storage(access_token=access_token)
     self.Users = Users(access_token=access_token)
     self.Utils = Utils(access_token=access_token)
     self.Video = Video(access_token=access_token)
     self.Wall = Wall(access_token=access_token)
     self.Widgets = Widgets(access_token=access_token)
def get_places():
    """
    This API analyses an image an returns the scenic place classification
    ---
    tags:
      - Image Analyzer
    consumes:
      - multipart/form-data
    produces: 
      -application/json
    parameters:
      - in: formData
        name: upfile
        type: file
        required: true
        description: Image file to analyse
    responses:
      500:
        description: Error, something went wrong!
      200:
        description: Detection success!
    """
    #logger=logging.getLogger(__name__)
    #logger.debug("Calling /places")
    model = Places()
    query_class = request.args.get('class')
    iFile = request.files.getlist('upfile')[0]
    img = load_image(iFile)
    img = rotate_image(img, iFile)
    img = limit_size_image(img)
    response = model.get_tags(img, query_class)
    return jsonify(response)
Esempio n. 3
0
 def __init__(self, server, id_, start_production, end_production):
     self.id_ = id_
     self.start_production = datetime(int(start_production[:4]),
             int(start_production[4:6]), int(start_production[6:8]))
     self.end_production = datetime(int(end_production[:4]),
             int(end_production[4:6]), int(end_production[6:8]))
     self.stop_areas = StopAreas(server, self)
     self.places = Places(self.stop_areas)
     self.journeys = Journeys(self)
     self.server = server
Esempio n. 4
0
    def __init__(self):
        self.client = zulip.Client(site="https://saharsh.zulipchat.com/api/")
        self.subscribe_all()
        self.trans = Translate()
        self.tw = Twimega()
        self.pnr = Pnr()
        self.weather = Weather()
        self.geo = Geocode()
        self.searching = Places()
        self.help = Help()

        print("Initialization Done ...")
        self.subkeys = [
            "translate", "weather", "pnr", "post", "post_image", "twitter",
            "help", "search"
        ]
Esempio n. 5
0
def parse_place(s):
    return Places(s, 0, 0)
Esempio n. 6
0
import sys, json
import plotly.offline as py

from places import Places
from search import paged_search, vectorized

if len(sys.argv) != 2:
    print('Usage: %s <subject>' % sys.argv[0])
    sys.exit(1)

SUBJECT = sys.argv[1]

places = Places('yso-paikat-skos.rdf')
results = paged_search(SUBJECT, places)
print(results)
vector = vectorized(results, places)
print(vector)

points = []
for point in vector:
    points.append(list(point))

basemap = []
with open('finland.geojson', 'r') as f:
    geojson = json.load(f)

    for feature in geojson['features']:
        if feature['geometry']['type'] == 'Polygon':
            basemap.extend(feature['geometry']['coordinates'][0])
            basemap.append([None, None])
Esempio n. 7
0
    def setUp(self):
        """Set up Places object with test data."""

        TestFile.create_test_json()
        self.testplaces: Places = Places("tests/test.json")
Esempio n. 8
0
    MessageEvent, TextMessage, TextSendMessage, SourceUser, SourceGroup,
    SourceRoom, TemplateSendMessage, ConfirmTemplate, MessageAction,
    ButtonsTemplate, ImageCarouselTemplate, ImageCarouselColumn, URIAction,
    PostbackAction, DatetimePickerAction, CarouselTemplate, CarouselColumn,
    PostbackEvent, StickerMessage, StickerSendMessage, LocationMessage,
    LocationSendMessage, ImageMessage, VideoMessage, AudioMessage, FileMessage,
    ImageSendMessage, UnfollowEvent, FollowEvent, JoinEvent, LeaveEvent,
    BeaconEvent, FlexSendMessage, BubbleContainer, ImageComponent,
    BoxComponent, TextComponent, SpacerComponent, IconComponent,
    ButtonComponent, SeparatorComponent, CarouselContainer, QuickReply,
    QuickReplyButton, LocationAction, CameraAction, CameraRollAction,
    ImagemapSendMessage)

app = Flask(__name__)
weather = Weather()
places = Places()
flight_api = FlightApi()
weather_aqi = WeatherAQI()
channel_secret = os.getenv('LINE_CHANNEL_SECRET', None)
channel_access_token = os.getenv('LINE_CHANNEL_ACCESS_TOKEN', None)

if channel_secret is None:
    print('Specify LINE_CHANNEL_SECRET as environment variable.')
    sys.exit(1)
if channel_access_token is None:
    print('Specify LINE_CHANNEL_ACCESS_TOKEN as environment variable.')
    sys.exit(1)
static_tmp_path = os.path.join(os.path.dirname(__file__), 'static', 'tmp')

line_bot_api = LineBotApi(channel_access_token)
handler = WebhookHandler(channel_secret)
Esempio n. 9
0
from users import User
from userfile import UserFile
from places import Places
from get_poi import TripAdvisorApi
from poi_data import PoiData

# Initialise user object and conduct API_key_check
# If no API key, user given instructions to subscribe.
# API_key saved as a persistent environment variable in src/.env and
# application rebooted, If there is a stored API_key, application
# will proceed.
user = User()

# place selection
place = Places()
selected_region = place.select_region()

# userfile object creation to search past history and display result if exists
user_file = UserFile(selected_region, user.path)
user_file.searchfile = f"{user_file.region[0]}-{user_file.region[1]}.json"

# history check at region level
history_check = user_file.search_and_display_data(selected_region)

# history check at city level
if not history_check:
    user_file.city = place.select_city(user_file.region)
    user_file.searchfile = f"{user_file.city[0]}-{user_file.city[1]}.json"
    history_check = user_file.search_and_display_data(user_file.city)

# look up TripAdvisorAPI if region and city does not exist in cached file