I want to create a simple script which will upload a file to my Drive every 5 minutes using cronjob. This is the code I have so far using the boilerplate code I extracted from different locations (mainly 2: getting started page & create page):
from __future__ import print_function
from apiclient import errors
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from googleapiclient.http import MediaFileUpload
def activateService():
creds = None
if os.path.exists('token.pickle'): …Run Code Online (Sandbox Code Playgroud) 这是当我尝试发送包含大量格式化超链接的长降价消息时出现的错误:
context.bot.send_message(chat_id=update.effective_chat.id, text=longmsg, parse_mode="MARKDOWN")
#Output:
telegram.error.BadRequest: Entities_too_long
Run Code Online (Sandbox Code Playgroud)
实际消息的长度几乎没有 500 个字符,但几乎每个单词都带有超链接,这使得字符串longmsg非常长(>12k 字符串长度)
现在,我知道对于普通消息,4096 个字符是限制,但在发送 Markdown 消息时,Telegram API 似乎允许 > 4096 个字符串长度。那么 Markdown 消息的确切字符串长度限制是多少?我正在使用python-telegram-bot图书馆。
我正在尝试绕过 web.whatsapp.com 二维码扫描页面。这是我到目前为止使用的代码:
options = webdriver.ChromeOptions();
options.add_argument('--user-data-dir=./User_Data')
driver = webdriver.Chrome(options=options)
driver.get('https://web.whatsapp.com/')
Run Code Online (Sandbox Code Playgroud)
第一次尝试时,我必须手动扫描 QR 码,而在以后的尝试中,它不会要求提供 QR 码。
但是,如果我在添加此行 chrome_options.add_argument("--headless") 后尝试执行相同的操作,则会出现将 DevTools 活动端口写入文件时出错。我尝试了至少十几种不同的谷歌搜索解决方案,但没有一个有效。对此的任何帮助将不胜感激!谢谢。
到目前为止,尝试了不同组合中的一堆不同参数,但没有任何效果:
options = Options() #decomment for local debugging
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-setuid-sandbox')
options.add_argument('--remote-debugging-port=9222')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-gpu') # Last I checked this was necessary.
options.add_argument('start-maximized')
options.add_argument('disable-infobars')
options.add_argument('--user-data-dir=./User_Data')
driver = webdriver.Chrome('chromedriver.exe', options=options)
driver.get('https://web.whatsapp.com/')
Run Code Online (Sandbox Code Playgroud)