import asyncio, httpx from apify import Actor import dotenv async def main(): async with Actor: proxy_configuration = await Actor.create_proxy_configuration( password=dotenv.get_key('.env', 'APIFY_PROXY_PASSWORD'), ) proxy_url = await proxy_configuration.new_url() proxies = { 'http': proxy_url, 'https': proxy_url, } async with httpx.AsyncClient(proxy=proxy_url) as client: for _ in range(3): response = await client.get('https://httpbin.org/ip') if response.status_code == 200: print(response.json()) elif response: print(response.text) if __name__ == '__main__': asyncio.run(main())
raise mapped_exc(message) from exc httpx.ReadTimeout [apify] INFO Exiting Actor ({"exit_code": 91})
main.py
logging works as expected, however in routes.py
logging is printed twice for some reason.Actor.log.info("STARTING A NEW CRAWL JOB")
[apify] INFO Checking item 17 [apify] INFO Checking item 17 ({"message": "Checking item 17"}) [apify] INFO Processing new item with index: 17 [apify] INFO Processing new item with index: 17 ({"message": "Processing new item with index: 17"})
main.py
(https://docs.apify.com/sdk/python/docs/concepts/logging) async def main() -> None: async with Actor: ##### SETUP LOGGING ##### handler = logging.StreamHandler() handler.setFormatter(ActorLogFormatter()) apify_logger = logging.getLogger('apify') apify_logger.setLevel(logging.DEBUG) apify_logger.addHandler(handler)
main.py
2x, and everything from routes.py
3x.[apify] INFO STARTING A NEW CRAWL JOB [apify] INFO STARTING A NEW CRAWL JOB ({"message": "STARTING A NEW CRAWL JOB"}) [apify] INFO STARTING A NEW CRAWL JOB ({"message": "STARTING A NEW CRAWL JOB"})
I have created a scraper but am having issues posting it to the store. I opened my account 2 days ago and would like to start earning money on my scraper
~ λ curl --proxy http://proxy.apify.com:8000 -U 'groups-RESIDENTIAL,country-US:apify_proxy_redacted' -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" https://httpbin.org/ip curl: (56) CONNECT tunnel failed, response 403