Comments (7)
I've forked the repo and re-implemented it with aiohttp
https://github.com/Kylmakalle/mixpanel-python-asyncio. Available for Python 3.7+.
I've rewritten the tests to asyncio
as well, so It should be safe enough to install.
Install
pip install https://github.com/Kylmakalle/mixpanel-python-asyncio/archive/1.0.0.zip
Code
from mixpanel_asyncio import Mixpanel
mp = Mixpanel(YOUR_TOKEN)
# tracks an event with certain properties
await mp.track(DISTINCT_ID, 'button clicked', {'color' : 'blue', 'size': 'large'})
# sends an update to a user profile
await mp.people_set(DISTINCT_ID, {'$first_name' : 'Ilya', 'favorite pizza': 'margherita'})
from mixpanel-python.
I believe this is an important improvement. Since requests
is sync, it blocks the event loop while waiting for a response.
This can impact frameworks such as FastAPI (or other asyncio based http frameworks). Blocking the event loop would make it so that the worker might not be able to process a request.
from mixpanel-python.
Yep, I've seen that you switched to requests recently. That's a missed opportunity because supporting async definitely means using another library. Ideally you want to use a single library for both the sync and async HTTP requests, like encode/httpx.
The codebase here is quite small and I've written multiple sync/async HTTP clients already (most notably notion-sdk-py); I could probably tackle this myself someday if you're interested in such a PR. Are you?
from mixpanel-python.
What's the roadmap exactly? I could bring Python 3 idiomatic features as well if you wish. Is there anything in particular that you want to achieve before?
from mixpanel-python.
Hello @ramnes - no, I haven't spent any time thinking about that. It sounds useful as an alternative backend, and if you end up with ideas about how this might look, I'd be happy to work with you on it. As it stands, the test suite for this project is heavily tied to requests
which I understand would not be used under an async variant of this library/class. I do have plans to open the design up a bit in the next major version to allow more flexibility - perhaps an async mode could influence that a bit.
from mixpanel-python.
@ramnes Let's come back to this once we've nixed Py2 support. Next major vers., which is cooking slowly.
from mixpanel-python.
Hello. I will support this issue. i want to see async support for this library. I have been using it for many years and in connection with the transfer of projects to the asynchronous stack it would be very appreciated
from mixpanel-python.
Related Issues (20)
- Connection reset by peer from BufferedConsumer HOT 10
- A way to register super properties HOT 1
- Missing APIs HOT 1
- how to do mixpanelGetEventsForProfiles HOT 1
- Pass `ip` event property HOT 1
- `import_data` does not work with Service Accounts due to missing `project_id` HOT 2
- Decimal values are not serializable as JSON in properties
- Clarify documentation for meta argument
- BufferedConsumer max_size limited to 50 HOT 1
- time_event functionality not available
- ConnectionResetError(104, 'Connection reset by peer') HOT 6
- I got `Remote end closed connection without response` error when I use Mixpanel with Slack Bolt SDK HOT 9
- Missing types for mypy HOT 2
- Mixpanel tracking is not working HOT 1
- Track time is sent in seconds
- Remove python 2.7 support
- Identify method is missing HOT 1
- mixpanel.MixpanelException: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) HOT 4
- 443 max retries exceeded error ['[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol] HOT 2
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 mixpanel-python.