Пример #1
0
def updateDB():
    #categories = []
    categories = caeateCategories()
    #saveObject('categories',categories)
    #categories=loadObject('categories')

    #categories_phone=[]
    categories_phone = phones(categories)
    #saveObject('categories_phone',categories_phone)
    #categories_phone=loadObject('categories_phone')
    MobileInfo = []

    from fonAPI import FonApi
    #key= '8b92be9f8d69b3494dafd73bddfbef61138a79982833eabc'
    fon = FonApi("8b92be9f8d69b3494dafd73bddfbef61138a79982833eabc")
    for category in categories_phone:
        for phone in category['phones']:
            device = phone['phoneName']
            phonesData = fon.getdevice(device)
            try:
                MobileInfo.append(phonesData)
            except:
                print(phonesData)
Пример #2
0
from fonAPI import FonApi

fon = FonApi('401bfde5401d0bdce2edddba6bcaa1d4bc8e4d17091b92cd')

#JC Testing git
#brand = 'Samsung '
phone = 'Samsung Galaxy J3 Smartphone, Android, 5", 4G LTE, SIM Free, 8GB,'


def phone_search(phone):
    '''function cycles through the website string and searches using fonoAPI.
     It shaves off a word from the string every time until the first phone match is found.'''
    phone_clean = phone.replace(',', '')  # removes commas from string
    result = ''
    l = 0
    while l < len(phone_clean):
        empty = ''
        phones = fon.getdevice(phone_clean.rsplit(
            ' ', l)[0])  # deletes the "l"th word
        try:  # fonoAPI name match command
            for phone in phones:
                empty = phone['DeviceName']
        except:
            empty = phones
        if empty != u'No Matching Results Found.':
            result = empty  # result is equal to the first result found by fonoAPI
            break
        else:
            l = l + 1
    print(result)
Пример #3
0
from fonAPI import FonApi

fon = FonApi('880232b5ecde964cbeaf16add69a727726c6a8f0878b9263')

device = 'OnePlus 6 - 128 GB'

phones = fon.getdevice(device)
try:
    for phone in phones:
        print(phone['DeviceName'])
        print(phone['weight'])
        print(phone['resolution'])
except:
    print(phones)

# DeviceName
# Brand
# technology
# 2g_bands
# gprs
# edge
# announced
# status
# dimensions
# weight
# sim
# type (display type)
# size
# resolution
# card_slot
# phonebook
Пример #4
0
from fonAPI import FonApi

fon = FonApi('yourKey')

device = '3210'
phones = fon.getdevice(device)
try:
    for phone in phones:
        print phone['DeviceName']
        print phone['weight']
        print phone['resolution']
except:
    print phones
Пример #5
0
from fonAPI import FonApi
import json

fon = FonApi('9c010908f0a93b5332ca50f3394c0518efb59fe3d483182b')

Models = ['samsung', 'nokia', 'sony', 'apple', 'lg', 'xiaomi', 'microsoft', 'htc', 'huawei']

print "Rozpoczynam pobieranie danych....\n"
phones = fon.getdevice("samsung")
Results = dict()

for Model in Models:
    if not  Model in Results:
        Results[Model] = dict()

    phones = fon.getdevice(Model)
    for phone in phones:
        Name = phone['DeviceName']
        Results[Model][Name] = phone

print "Zapisuje dane\n"
with open('phpnes.json', 'w') as outfile:
    json.dump(Results, outfile)

print "Zakonczono\n"
Пример #6
0
import logging
import traceback
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.utils import is_intent_name, is_request_type
from ask_sdk_core.handler_input import HandlerInput

from ask_sdk_model.ui import SimpleCard
from ask_sdk_model import Response

from fonAPI import FonApi

sb = SkillBuilder()
fon = FonApi('2aa34af87f48dac8664a57d6aab647d3c4547a828c74b4d0')

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


@sb.request_handler(can_handle_func=is_request_type("LaunchRequest"))
def LaunchRequestHandler(handler_input):
    speech_text = "Welcome to Mobile Specs, you can say tell me about new iphone X"
    return handler_input.response_builder.speak(speech_text).set_card(
        SimpleCard("Device Description",
                   speech_text)).set_should_end_session(False).response


@sb.request_handler(
    can_handle_func=is_intent_name("GetDeviceDescriptionIntent"))
def GetDeviceDescriptionIntent(handler_input):
    device = getSlotValue('DEVICE', handler_input)
    print("\nSLOT DEVICE", device)
Пример #7
0
# -*- coding: utf-8 -*-
"""Simple Bot to reply to Telegram messages.

This is built on the API wrapper.
This program is dedicated to the public domain under the CC0 license.
"""
import logging
import telegram
from telegram.error import NetworkError, Unauthorized
from time import sleep
from telegram import ReplyKeyboardMarkup
import requests
from fonAPI import FonApi
from time import gmtime, strftime

fon = FonApi('Token from fonApi')
update_id = None
m = None
n = None
c = None
sr = None
ss = None
w = None
startmessage = None
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))


def main():
    """Run the bot."""
    global update_id
    # Telegram Bot Authorization Token
Пример #8
0
import xlrd
import csv
from fonAPI import FonApi
import sys

reload(sys)
sys.setdefaultencoding('utf8')
fon = FonApi('b0021284efcdf57c5e88870120a3c43f498977c5b59f0854')
devices = [
    'apple', 'samsung', 'Huawei', 'Google', 'LG', 'Motorola', 'HTC', 'xiaomi',
    'motorola', 'oneplus', 'Honor'
]
#device = 'apple'
fd = open('phone.csv', 'a')
#phones = fon.getdevice(device)
s = ""
contents = ""
with open('phone.csv') as f:
    s = f.read() + '\n'  # add trailing new line character


def addPhone(fields):
    with open(r'phone.csv', 'a') as f:
        writer = csv.writer(f)
        writer.writerow(fields)


def findPhone(device):
    if device in s:  # if the username shall be on column 3 (-> index 2)
        return True