hmiku8338 / e621 Goto Github PK
View Code? Open in Web Editor NEWA feature-rich high-level e621 and e926 API wrapper
License: MIT License
A feature-rich high-level e621 and e926 API wrapper
License: MIT License
Line 501 in e71fc86
I'm not sure why this isn't set up as:
class _PostsGetterMixin:
@cached_property
def posts(self: _HasPostIdsAndE621API) -> List[Post]:
return self.e621api.posts.search(
tags=f"id:{','.join(map(str, self.post_ids))}",
ignore_pagination=True,
limit=len(self.post_ids),
)
Which seems to max out at 100 posts but even simpler would be:
class _PostsGetterMixin:
@cached_property
def posts(self: _HasPostIdsAndE621API) -> List[Post]:
return self.e621api.posts.get(self.post_ids)
Which but even this still maxes out at 100 posts.
The pool I'm using as a test has 297 posts at this moment.
Hey, I'm trying to get e926 to work and I am getting.
>>> from e621 import E926
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\e621\__init__.py", line 1, in <module>
from .api import E621, E926
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\e621\api.py", line 3, in <module>
from . import endpoints
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\e621\endpoints.py", line 28, in <module>
from .models import (
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\e621\models.py", line 405, in <module>
class Post(BaseModel):
File "pydantic\main.py", line 188, in pydantic.main.ModelMetaclass.__new__
File "pydantic\typing.py", line 419, in pydantic.typing.resolve_annotations
def Union(self, parameters):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\typing.py", line 277, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\typing.py", line 533, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'ModelMetaclass' and 'NoneType'
Thanks
I fixed the code as soon as I could, everything seemed to start working. Here are my edits (endpoints.py )
"upload[source]": ",".join(sources),
- source, not sourcesr = self._api.session.post("uploads", files=files, data=params)
- There was an error "File not provided" or something like thatI tried to load the content to e621ng (repo), which I launched locally. I used the library to overload art with e621.net on a local installation
Code:
login=('my user id', 'my api key') # for illustration
api = E621(login)
print(api.logged_in())
print('Posting search requiest...')
print(api.posts.search(''female", page=1, limit=1)[0])
Result
True
Posting search requiest...
Traceback (most recent call last):
File "h:\ttkkp\horny doge\e621_download.py", line 29, in <module>
posts = api.posts.search(tag_entry, limit=1, page=1)
File "C:\Users\TowardTheStars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\e621\endpoints.py", line 224, in search
posts = self._default_search({"tags": tags}, limit, page, ignore_pagination)
File "C:\Users\TowardTheStars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\e621\endpoints.py", line 120, in _default_search
resp = self._api.session.get(self._url, params=params)
File "C:\Users\TowardTheStars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 601, in get
return self.request("GET", url, **kwargs)
File "C:\Users\TowardTheStars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\e621\session.py", line 33, in request
r.raise_for_status()
File "C:\Users\TowardTheStars\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://e621.net/posts.json?tags=female&limit=1&page=1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.