Skip to content

Commit

Permalink
feat: pypi
Browse files Browse the repository at this point in the history
Signed-off-by: yihong0618 <[email protected]>
  • Loading branch information
yihong0618 committed Mar 4, 2024
1 parent bdea9f0 commit 44b1aba
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ About High quality image generation by ideogram. Reverse engineered API.
python -m ideo --prompt 'a big red cat'
```

or
```
pip install -U ideo
```

```python
from ideo import ImageGen
i = ImageGen('cookie', 'user_id', 'auth_token') # Replace 'cookie', 'user_id', and 'auth_token' with your own values
print(i.get_limit_left())
i.save_images("a blue cyber dream", './output')
```

## Thanks

- [chatgpt-telegram-bot](https://github.com/brainboost/chatgpt-telegram-bot)
1 change: 1 addition & 0 deletions ideo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .ideo import ImageGen
9 changes: 3 additions & 6 deletions ideo/ideo.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import argparse
import contextlib
import json
import os
import re
import time
from http.cookies import SimpleCookie
import json
import os

from curl_cffi import requests
from curl_cffi.requests import Cookies
Expand All @@ -31,16 +29,15 @@


class ImageGen:

def __init__(self, cookie: str, user_id: str, auth_token: str) -> None:
self.session: requests.Session = requests.Session()
HEADERS["user-agent"] = ua.random
self.cookies = cookie
self.cookie = cookie
self.user_id = user_id
self.auth_token = auth_token
HEADERS["Authorization"] = f"Bearer {auth_token}"
self.session.headers = HEADERS
self.session.cookies = self.parse_cookie_string(cookie)
self.session.cookies = self.parse_cookie_string(self.cookie)

@staticmethod
def parse_cookie_string(cookie_string):
Expand Down
32 changes: 32 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from setuptools import find_packages, setup

setup(
name="ideo",
version="0.1.1",
author="yihong0618",
author_email="[email protected]",
description="High quality image generation by ideogram.ai. Reverse engineered API.",
url="https://github.com/yihong0618/IdeoImageCreator",
project_urls={
"Bug Report": "https://github.com/yihong0618/IdeoImageCreator/issues/new",
},
install_requires=[
"curl_cffi",
"requests",
"fake-useragent",
],
packages=find_packages(),
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
entry_points={
"console_scripts": ["ideo = ideo.ideo:main"],
},
classifiers=[
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)

0 comments on commit 44b1aba

Please sign in to comment.