This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqs= boto3.resource('sqs', aws_access_key_id = AWS_ACCESS_KEY_ID, | |
aws_secret_access_key = AWS_SECRET_ACCESS_KEY, | |
region_name = REGION_NAME) | |
def receive_message_from_sqs(spider,delete=True): | |
queue = sqs.get_queue_by_name(QueueName=spider) | |
rows = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
module = application:app | |
master = true | |
processes = 3 | |
chdir = YOUR_PROJECT_PATH | |
socket = YOUR_SOCK_FILE_PATH | |
chmod-socket = 777 | |
vacuum = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('I am hungry Friday and Saturday is beautiful day') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aiohttp import gather, create_task | |
from string import Template | |
from aiohttp import web, ClientSession | |
from bs4 import BeautifulSoup | |
async def news(request): | |
sites = [ | |
('http://edition.cnn.com',cnn_articles), | |
('http://www.aljazeera.com',aljazeera_articles) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = ( | |
"\033[0m", # End of color | |
"\033[36m", # Cyan | |
"\033[91m", # Red | |
"\033[32m", # Green | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
from threading import current_thread | |
from asyncio import Future | |
import asyncio | |
import time | |
c = ( | |
"\033[0m", # End of color | |
"\033[36m", # Cyan | |
"\033[91m", # Red |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import itertools as it | |
import os | |
import random | |
import time | |
async def makeitem(size: int = 5) -> str: | |
return os.urandom(size).hex() | |
async def randsleep(a: int = 1, b: int = 5, caller=None) -> None: |
OlderNewer