1561561
6516515
3737683
5679446
9844310
1529674
2629845
vkid = '5679446'
banlist = []
with open('txt.txt') as f:
for x in f:
banlist.append(x.strip())
if vkid in banlist:
print('BAN')
import requests
url = "https://mysite.com/5"
querystring = {"embed":"1%20HTTP/1.1"}
headers = {
'Host': "t.me",
'Connection': "keep-alive",
'Upgrade-Insecure-Requests': "1",
'User-Agent': "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36",
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
'Referer': "https://mysite.com",
'Accept-Encoding': "gzip, deflate, br",
'Accept-Language': "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
'Cookie': "_ga=GA1.2.1169963389.1523803584; stel_web_auth=https%3A%2F%2Fweb.telegram.org%2F; stel_ssid=31dffdd3cd3dca265d_2963das1217952533; _gid=GA1.2.1199944186.1524831182",
'Cache-Control': "no-cache",
'Postman-Token': "930f1009-7e5f-436e-9b5f-da372e57ac8c"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
json = {'data':{'variables':{'startupProcessInfo':{'iin': 'first'}}, 'piid': 'second', 'executionState': 'third', 'creationTime': 'fourth'}}
path_arr = ["['data']['variables']['startupProcessInfo']['iin']",
"['data']['piid']",
"['data']['executionState']",
"['data']['creationTime']"]
for x in path_arr:
json_iter = json
path = x[2:-2].split("']['")
for p in path:
json_iter = json_iter[p]
print(json_iter)
========================== RESTART: E:/Python/1.py ==========================
first
second
third
fourth
from datetime import datetime
import pytz
date = '2017-08-01T23:14:41+03:00'# Входная дата-время
dateISO = date[:-5]+date[-5:].replace(':','')# Приводим к формату 2017-08-01T23:14:41+0300
utc = datetime.strptime(dateISO, '%Y-%d-%mT%H:%M:%S%z')# Переводим строку в datatime
localFormat = "%Y-%m-%d %H:%M:%S%z"# Формат вывода даты и времени(часовая зона "%z" оставлена для наглядности)
timezones = ['Africa/Abidjan', 'Antarctica/Vostok']# Первая таймзона +00:00, вторая +06:00(что на 3 часа больше, судя по задаче)
print(utc.strftime(localFormat))# Вывод входной даты и времени
for tz in timezones:# Вывод даты и времени в другом часовом поясе
localDatetime = utc.astimezone(pytz.timezone(tz))
print(localDatetime.strftime(localFormat))
2017-01-08 23:14:41+0300
2017-01-08 20:14:41+0000
2017-01-09 02:14:41+0600
from __future__ import print_function
import httplib2
import os
import configparser as cfg
import requests
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
SCOPES = 'https://www.googleapis.com/auth/spreadsheets'
CLIENT_SECRET_FILE = 'client_id.json'
APPLICATION_NAME = 'APPLICATION_NAME'
config = cfg.ConfigParser()
config.read('Config.ini', encoding='utf_8') # чтение конфиг файла
GDURL = config['DEFAULT']['GDURL'] # ссылка на ГД
RangeName = config['DEFAULT']['RangeName'] # Название листа в ГД
def get_credentials():
home_dir = os.path.expanduser('~')
credential_dir = os.path.join(home_dir, '.credentials')
if not os.path.exists(credential_dir):
os.makedirs(credential_dir)
credential_path = os.path.join(credential_dir, 'sheets.googleapis.com-python-quickstart.json')
store = oauth2client.file.Storage(credential_path)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
flow.user_agent = APPLICATION_NAME
if flags:
credentials = tools.run_flow(flow, store, flags)
else: # Нужно для Python 2.6
credentials = tools.run(flow, store)
print('Storing credentials to ' + credential_path)
return credentials
def main():
requests.packages.urllib3.disable_warnings()
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
discoveryUrl = ('https://sheets.googleapis.com/$discovery/rest?'
'version=v4')
service = discovery.build('sheets', 'v4', http=http, discoveryServiceUrl=discoveryUrl)
spreadsheetId = str(GDURL).split('/')[5]
result = service.spreadsheets().values().get(
spreadsheetId=spreadsheetId, range=RangeName).execute()
values = result.get('values', [])
if not values:
print('Нет данных')
else:
# здесь мой код
if __name__ == '__main__':
main()
import pandas as pd
import xlrd as xr
excelreed = xr.open_workbook('1.xlsx')
oneexcel = excelreed.sheet_by_index(0)
excelreed = xr.open_workbook('2.xlsx')
twoexcel = excelreed.sheet_by_index(0)
list_j = []
for i in range(1,oneexcel.nrows):
for j in range(1,twoexcel.nrows):
if twoexcel.row_values(j)[0] == oneexcel.row_values(i)[0]:
list_j.append(oneexcel.row_values(i) + twoexcel.row_values(j)[1:])
df = pd.DataFrame(list_j)
df.to_excel('out.xlsx', header=False, index=False)
#!/bin/bash
kill $(ps aux | grep 'bot.py' | awk '{print $2}')
python /var/TelBot/bot.py