Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
"""Test helper to fetch Shelly config using aiohttp digest authentication.""" import asyncio from aiohttp import ClientSession, DigestAuthMiddleware async def fetch_with_digest_auth(url: str, username: str, password: str) -> str: """Fetch a URL using HTTP Digest Authentication.""" # aiohttp supports digest auth via DigestAuth class digest_auth = DigestAuthMiddleware(login=username, password=password) async with ( ClientSession() as session, session.get(url, middlewares=(digest_auth,)) as response, ): print(f"Status: {response.status}") return await response.text() async def main() -> None: """Main function to run the fetch.""" url = "http://192.168.1.93/rpc/Shelly.GetConfig" username = "admin" password = "Simo" try: content = await fetch_with_digest_auth(url, username, password) print("Response content:") print(content) except Exception as e: print(f"Error: {e}") if __name__ == "__main__": asyncio.run(main())
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)