コード例 #1
0
class TestYandexDiscFails:
    def setup(self):
        self.token = yandex_token
        self.yandex_disc2 = Yandex(self.token)
        self.folder = 'test_folder'
        self.HEADERS = {"Authorization": f"OAuth {self.token}"}

    def teardown(self):
        pass

    def test_fail_create_folder_409(self):
        response = self.yandex_disc2.create_folder(self.folder)
        assert response.status_code == 409

    def test_fail_create_folder_400(self):
        self.folder = 90
        response = requests.put(
            'https://cloud-api.yandex.net/v1/disk/resources',
            headers=self.HEADERS)
        assert response.status_code == 400

    def test_fail_create_folder_401(self):
        data = {'path': self.folder}
        response = requests.put(
            'https://cloud-api.yandex.net/v1/disk/resources', params=data)
        assert response.status_code == 401

    def test_fail_create_folder_404(self):
        data = {'path': self.folder}
        response = requests.put(
            'https://cloud-api.yandex.net/v1/disk/resorces',
            headers=self.HEADERS,
            params=data)
        assert response.status_code == 404
コード例 #2
0
class TestYandexDisc:
    def setup(self):
        self.token = yandex_token
        self.yandex_disc1 = Yandex(self.token)

    def teardown(self):
        pass

    def test_create_folder(self):
        response = self.yandex_disc1.create_folder('vsaf')
        assert response.status_code == 201
コード例 #3
0
ファイル: main.py プロジェクト: DenisAzarenko777/yandex
"""This is the main entry point"""
import datetime
import json
import time
from progress.bar import IncrementalBar
from photo import Vresponse
from yandex import Yandex

if __name__ == '__main__':
    KEY_FOR_YANDEX = str(input('Введите ваш токен для Яндекс диска: '))
    ID_VK = str(input('Введите ваш id '))
    TOKEN_VK = str(input("Введите ваш ключ для ВК: "))
    NUMBER_FOR_SAVE_PHOTO = int(
        input("Введите какое количество фотографий вы хотите сохранить: "))
    User = Vresponse(token=TOKEN_VK, id=ID_VK)
    User.response()
    User.control_function(NUMBER_FOR_SAVE_PHOTO)
    Yan = Yandex(token=KEY_FOR_YANDEX)
    Yan.load()
コード例 #4
0
ファイル: main.py プロジェクト: StasEvseev/crawler
def main():
    ya = Yandex()
    print ya.get_serp('спецификация doc файла', 55, '213')
コード例 #5
0
ファイル: __init__.py プロジェクト: srisankethu/query-server
from yahoo import Yahoo
from ask import Ask
from yandex import Yandex
from baidu import Baidu
from exalead import Exalead
from quora import Quora
from youtube import Youtube
from parsijoo import Parsijoo

scrapers = {
    'g': Google(),
    'b': Bing(),
    'y': Yahoo(),
    'd': Duckduckgo(),
    'a': Ask(),
    'yd': Yandex(),
    'u': Baidu(),
    'e': Exalead(),
    'q': Quora(),
    't': Youtube(),
    'p': Parsijoo()
}


def read_in():
    lines = sys.stdin.readlines()
    return json.loads(lines[0])


def small_test():
    assert isinstance(scrapers.google.results_search('fossasia'), list)
コード例 #6
0
import pyodbc
from yandex import Yandex
from account import Account

#Create Context


account = Account()
account.generate_account()

yandex = Yandex(account,CAPTCHAAPI,PROXY_USER,PROXY_USER_PASSWORD)
yandex.create_account()

con = pyodbc.connect(driver="{SQL Server}",server=DBSERVER,database=DBDATABASEINSTANCE,uid=DBUSERNAME,pwd=DBPASSWORD)
db_cmd = "INSERT INTO [dbo].[ImaginaryUsers] VALUES ('EmailCreated','"+yandex.account.mail+"','"+account.firstName+"','"+account.lastName+"','"+yandex.account.mail+"@yandex.com',null,'"+account.gender+"','"+account.birthYear+"-"+account.birthMonth+"-"+account.birthDay+"',GETDATE(),'"+workerUser+"',GETDATE(),'"+CURRENT_USER+"','"+account.password+"',NULL,NULL)"
print (db_cmd)
con.execute(db_cmd)
con.commit()
コード例 #7
0
 def setup(self):
     self.token = yandex_token
     self.yandex_disc2 = Yandex(self.token)
     self.folder = 'test_folder'
     self.HEADERS = {"Authorization": f"OAuth {self.token}"}
コード例 #8
0
 def setup(self):
     self.token = yandex_token
     self.yandex_disc1 = Yandex(self.token)
コード例 #9
0
from yandex import Yandex
from youtube import Youtube

scrapers = {
    'ask': Ask(),
    'baidu': Baidu(),
    'bing': Bing(),
    'dailymotion': Dailymotion(),
    'duckduckgo': Duckduckgo(),
    'exalead': Exalead(),
    'google': Google(),
    'mojeek': Mojeek(),
    'parsijoo': Parsijoo(),
    'quora': Quora(),
    'yahoo': Yahoo(),
    'yandex': Yandex(),
    'youtube': Youtube()
}


def small_test():
    assert isinstance(scrapers['google'].search('fossasia'), list)


def feedgen(query, engine, count=10):
    engine = engine.lower()
    # provide temporary backwards compatibility for old names
    old_names = {
        'ubaidu': 'baidu',
        'vdailymotion': 'dailymotion',
        'tyoutube': 'youtube'
コード例 #10
0
from yandex import Yandex
from account import Account

account = Account()
account.generate_account()

yandex = Yandex(account, '2capthca-api-key')
yandex.create_account()
コード例 #11
0
def main():
    ya = Yandex()
    print ya.get_serp('спецификация doc файла', 55, '213')
コード例 #12
0
from yandex import Yandex
from googleapiclient.discovery import build
import json
import apis
# вопросительные слова для выкидывания из начала вопроса при поиске вместе с ответами
qwords = ["Что", "Чем", "Где", "Когда", "Кто", "Кем", "Кому", "Почему", "Зачем", "Как", "Какой", "Какая", "Какие", "Какое", "Какому", "Каким", "Кaкую", "Чей", "Сколько", "Куда", "Откуда"]
api = CleverApi(apis.CLEVER)
lp = CleverLongPoll(api)
# словарь для перевода числительных 0-9
units = (
    u'ноль', u'один',  u'два',
    u'три', u'четыре', u'пять',
    u'шесть', u'семь', u'восемь', u'девять'
)

yandex = Yandex(api_user=apis.YANDEX_LOGIN, api_key=apis.YANDEX_KEY)
google = build("customsearch", "v1", developerKey=apis.GOOGLE_KEY, cache_discovery=False)

# получение текстового названия цифры
def digit_name(s):
    # проверка на число от 0 до 9
    if len(s) > 1: 
        return s
    try:
        n = int(s)
        if n >= 0 and n <10:
            return units[n]
        return s
    except ValueError:
        return s
# предварительная обработка ответов