From 0858b51cbfe522c8aea6589a78726ee585cd8536 Mon Sep 17 00:00:00 2001 From: sudoskys Date: Wed, 7 Feb 2024 12:36:43 +0800 Subject: [PATCH] :sparkles: feat: add user login functionality - Added user login functionality to the novelai-python project. - Updated the main function to include LoginCredential. - Created a globe_s2 object to store the login credentials. - Added the username and password environment variables to the dotenv file. ShortTaskResultWithoutChanges: :sparkles: feat: add user login functionality - Added user login functionality to the novelai-python project. - Updated the main function to include LoginCredential. - Created a globe_s2 object to store the login credentials. - Added the username and password environment variables to the dotenv file. --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index da5e11e..28ca11d 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ The goal of this repository is to use Pydantic to build legitimate requests to a - [x] /ai/generate-image - [x] /user/subscription +- [x] /user/login - [ ] /ai/generate-image/suggest-tags - [ ] /ai/annotate-image - [ ] /ai/classify @@ -28,7 +29,7 @@ import os from dotenv import load_dotenv from pydantic import SecretStr -from novelai_python import GenerateImageInfer, ImageGenerateResp, JwtCredential +from novelai_python import GenerateImageInfer, ImageGenerateResp, JwtCredential, LoginCredential load_dotenv() @@ -36,7 +37,13 @@ enhance = "year 2023,dynamic angle, best quality, amazing quality, very aesthet async def main(): - globe_s = JwtCredential(jwt_token=SecretStr(os.getenv("NOVELAI_JWT"))) + globe_s = JwtCredential( + jwt_token=SecretStr(os.getenv("NOVELAI_JWT")) + ) + globe_s2 = LoginCredential( + username=os.getenv("NOVELAI_USERNAME"), + password=SecretStr(os.getenv("NOVELAI_PASSWORD")) + ) _res = await GenerateImageInfer.build( prompt=f"1girl,{enhance}").generate( session=globe_s)