Comments (8)
If we want to achieve the below behavior, how about this code?
the client pulls the current active loop or creates a new one.
try:
self.loop: AbstractEventLoop = asyncio.get_running_loop()
except RuntimeError:
# if there is no running loop, create a new event loop
self.loop: AbstractEventLoop = asyncio.new_event_loop()
I guess no event loop is set by default for a new thread.
Also note that starting from python 3.10, get_event_loop
becomes deprecated and it will be identical with get_running_loop
(doc)
from tiktoklive.
For sure! The server can handle a few hundred requests a second before I'd need to up the capacity, which will never happen. Just don't want TikTok to tighten security again because the library is used for spam!
Thanks for the help, enjoy the new version!
Isaac
from tiktoklive.
It's interesting because it works in the main thread, but not in new threads. I do not know why this is. More than likely I misunderstood the use of get_event_loop
from tiktoklive.
If we want to achieve the below behavior, how about this code?
the client pulls the current active loop or creates a new one.
try: self.loop: AbstractEventLoop = asyncio.get_running_loop() except RuntimeError: # if there is no running loop, create a new event loop self.loop: AbstractEventLoop = asyncio.new_event_loop()I guess no event loop is set by default for a new thread.
Also note that starting from python 3.10,
get_event_loop
becomes deprecated and it will be identical withget_running_loop
(doc)
Looks good. Do you want to make a pull request? If not, I will when I have a bit of free time next.
My job can betime consuming. Plus, 'twas your find :)
from tiktoklive.
@isaackogan Hi thanks for the offer. I submitted a PR for this. Hope you can check it when you get a chance π .
from tiktoklive.
Tested locally in 3.8, looks good. Merged into master and will be released in today's update
from tiktoklive.
One comment, @tmokmss
If your intention is to run multiple clients, there's an IP rate limit for signing connections to respect fair use of TikTok services.
There are a million different reasons to thread, so I won't presume that's why you want to, but, just in-case you wanted to set up a bunch of clients at once, you will need an API key.
Thanks for the contribution, releasing the update now!
from tiktoklive.
New API key feature? Sounds cool, thanks!
I'm currently using it in my small hobby project (hoping it is not harming your server π ) but I'll definitely contact you when I need larger-scale access.
from tiktoklive.
Related Issues (20)
- i don't know how to fix this issue in 6.0.1ver i fix this in 5.0.8ver
- Random exception HOT 3
- ImportError: cannot import name 'User' from 'TikTokLive.proto' HOT 2
- OSError: [WinError 6] The handle is invalid HOT 1
- OSError: [WinError 6] Identificador invΓ‘lido HOT 1
- No Output HOT 2
- I get an error [SIGN_NOT_200] HOT 1
- . HOT 3
- HS ? HOT 1
- Getting error after inherit in latest package(version-6.0.3) HOT 8
- no output HOT 8
- how can get total likes in live HOT 1
- stop tiktokLiveClient HOT 1
- Failed to connect to TikTokLive: [EMPTY_PAYLOAD] Sign API returned an empty request. Are you being detected by TikTok? HOT 4
- TikTokLive.client.errors.UserOfflineError HOT 2
- Gift examples doesnt work anymore "count" HOT 2
- SendMessage Method HOT 1
- httpx.Timeout Error HOT 4
- Unexpected error fetching when user is offline HOT 2
- Video download failed after few time later HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiktoklive.