muxinc / mux-python Goto Github PK
View Code? Open in Web Editor NEWOfficial Mux API wrapper for python projects, supporting both Mux Data and Mux Video.
License: MIT License
Official Mux API wrapper for python projects, supporting both Mux Data and Mux Video.
License: MIT License
When using mux-python
I get this warning:
DeprecationWarning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
The problem is here at this line:
Line 43 in d896eab
It should be changed to:
return self.urllib3_response.headers
If I prepare a pull request, are you willing to accept it? Thanks
A number of exceptions are thrown by muxpython but none of them can by caught by clients because:
__init__.py
is making it impossible to import them directly from rest.pyThe simplest solution would be to export them all in __init__.py
.
I'm happy to make a pull request if you'd like?
Hi,
I am struggling to use this library to upload videos to Mux. I have read through the documentation, ReadMe and examples in this repo. I have also been through the process of uploading to Mux using the web UI.
I can see the DirectUploadsApi and example makes what seems to be a "pre-request to upload", which returns a Google Storage URL to upload to and the info I need about where the upload will go/be called etc. But I seem to be missing the methods or documentation that then use or describe what I need to do with that URL to actually do the upload.
Any help or guidance would be much appreciated! I think the TODO in https://github.com/muxinc/mux-python/blob/master/examples/video/exercise-uploads.py is probably what I need?
"# TODO: At some point I'd like to actually perform an upload here and check the state changes etc. but I don't have time right now."
Thanks
Is there any documentation on creating audio-only assets? I see the announcement from years ago that it became available as a feature, but I'm struggling to find relevant documentation.
Video view information should include an asset ID in the response.
https://github.com/muxinc/mux-python/blob/master/mux_python/models/video_view.py
Hello, I am trying to create the mp4 format stream for playback. However setting the parameter :
new_asset_settings = mux_python.CreateAssetRequest(playback_policy=[mux_python.PlaybackPolicy.PUBLIC], mp4_support = "standard")
This gives the response :
'new_asset_settings': {'input': None, 'master_access': None, 'mp4_support': 'standard', 'normalize_audio': False, 'passthrough': None, 'per_title_encode': None, 'playback_policy': None, 'test': None},
How can I use .mp4 format with the playback ID to make it work?
Hello!
I’m trying to obtain data for the real-time engagement counts. but looks like it’s not working correctly.
I use code from the example, like a
# video_id = '' # Enter your video id here
signing_key_id = '2pFHlr6WB9npEwHvONm8CRTZOxjpJHXyPCpjEGDIwZI' # Enter your signing key id here
private_key_base64 = 'HERE IS THE PRIVATE KEY AS IT WAS RECEIVED FROM DASHBOARD' # Enter your base64 encoded private key here
private_key = base64.b64decode(private_key_base64)
time_issued = int(time.time()) + 3600
payload = {
'vid': video_id,
'exp': time_issued, # 1 hour
'kid': signing_key_id
}
encoded = jwt.encode(payload, private_key, algorithm="RS256")
return jsonify({
'result': {
'token': encoded,
'expire': time_issued
}
})
So, if i use it like this - i will receive python error binascii.Error: Incorrect padding . It can be fixed with simple adding ==
at the end of private key string, and after that code is working fine - i receive encoded token.
But when I try to hit the url https://stats.mux.com/counts?token=TOKEN_TEXT_HERE i receive error :
{
"error": {
"type": "forbidden",
"messages": [
"Signing key not found."
]
}
}
Anything we can do here?
Hello, Currently my live stream is broadcasting the chunks in ".ts" format. I would like to change the "HLS_segement_type" to .fmp4. Is there a parameter I can tune to convert the .ts chunk into .fmp4?
Hello.
Case 1: Use the MUX direct upload SDK for react
I created a component for frontend which works but the problem there is that the response from event doesn't contain the playbackID for the uploaded video. I find the video on my MUX assets, but I want to get the playbackID directly from response and that is not there. Is something I miss here?
Case 2: Uploade video from python wrapper
I can upload an asset using mux-python package, but when I want to upload it, it's required the video URL... I want to upload a file in my platform, so it would be a local file (not an URL). Can you help me here?
My goal is to upload a video (with the upload interface from MUX-UPLOADER or by creating my own interface in frontend) and get as a response the assetID and playbackID which I will store in my DB to be able to create a video content platform.
Thanks
Hi
This is my code to upload my video to Mux via Python:
assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))
# Create an Asset
input_settings = [mux_python.InputSettings(url=modelVideoFirebaseURL)]
create_asset_request = mux_python.CreateAssetRequest(input=input_settings, playback_policy=[mux_python.PlaybackPolicy.PUBLIC])
create_asset_response = assets_api.create_asset(create_asset_request=create_asset_request)
However, when I upload it I cannot view it in Assets (it says video is not public and is not viewable).
Also, when I view my video client side it says "Unsupported error" and that it is not playable on my browser.. But if I play a directly uploaded video on my client side it works.. The API does not work. Please help
Hello!
Currently pip show mux-python
returns blank License info:
Name: mux-python
Version: 3.10.0
Summary: Mux API
Home-page: https://github.com/muxinc/mux-python
Author: Mux DevEx
Author-email: [email protected]
License:
Location: ...
Requires: python-dateutil, six, urllib3
Required-by:
Some company's custom package index might check for eligible values in License
field before allowing the package to be added. Curious if we could add the license info here? Thanks!
Is there such an option? E.g. defining the width and height of the video before downloading it with mux_python.AssetsApi(mux_python.ApiClient(config)).get_asset()
?
How do I just put a loading screen or autorefresh on the Mux Player when I get:
"Video is not currently available The live stream or video files are not ready yet."
?
mux-python/mux_python/configuration.py
Line 173 in c2df765
maybe you need to add this variable to the Configuration Constructor parameters so that it can be initialized when creating the API?
def __init__(self, host=None, ..., verify_ssl = True)
and then:
self.verify_ssl = verify_ssl
Passing on the request. Alex Steel may have more context if needed.
Dear coolleagues. Thanks so much for the amazing work done.
I am trying to update an asset, just like presented here, but passing the asset id to be updated from the list I got from assets_api.list_assets()
, instead of an assets_api.create_asset(create_asset_request)
object.
Error message I got is:
mux_python.exceptions.NotFoundException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Cache-Control': 'max-age=0, private, must-revalidate', 'Content-Length': '121', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 16 Sep 2021 12:57:44 GMT', 'Server': 'Mux API Server v1.131.2', 'X-Request-Id': 'FqVOyN_5MDLCiXUBWLmD'})
HTTP response body: {"error":{"type":"not_found","messages":["The requested resource either doesn't exist or you don't have access to it."]}}
The asset id exists and is the correct one. So, I am wondering if:
thanks in advance
Please add an example for "max_continuous_duration". There is no example available on how to use the "duration" parameter for a live stream.
I am not able to find how to set the duration in API request.
I am getting the following error : "'Server': 'Mux API Server v1.158.3', 'X-Request-Id': 'FvnrJ5bJcVMDeN0Hi62B'})
HTTP response body: {"error":{"type":"invalid_parameters","messages":["Cannot use max continuous duration with test live streams"]}}"
Are there undocumented situations which might cause Mux to return a 401 (and therefore cause the client to raise an UnauthorizedException)?
I can't really share the code, but I can share the context:
Attempts to create or delete assets functions well enough in local. Attempts to create or delete assets raises an UnauthorizedException across our development, staging, and production environments.
The kicker, though, is that this all worked as recently as a week ago, and there were no new deploys to our production system before the issues started arising.
I'm wondering if there is potential that Mux would blacklist a server? All of our environments are deployed via managed Docker containers in DigitalOcean, so that seems the most noteworthy similarity between the three environments having issue.
I generated a signed_url by passing appropriate cors_origin as per my domain yet the generated URL, I am unable to PUT the video file from browser.
Here is the error I am getting:
Access to fetch at 'https://storage.googleapis.com/video-storage-us-east1-....' from origin 'https://youreact.tv' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
And here is my backend code that generates the signed URL:
uploads_api = mux_python.DirectUploadsApi(mux_python.ApiClient(configuration))
create_asset_request = mux_python.CreateAssetRequest(playback_policy=[mux_python.PlaybackPolicy.PUBLIC],passthrough="123")
create_upload_request = mux_python.CreateUploadRequest(timeout=3600, new_asset_settings=create_asset_request, cors_origin="https://youreact.tv")
create_upload_response = uploads_api.create_direct_upload(create_upload_request)
and here is the client side code that tries to PUT the video file:
const upload = async (file) => {
const upload = UpChunk.createUpload({ endpoint: '{{ signed_url }}', file: file }); console.log("res:",upload) }
Change:
To reference: https://docs.mux.com/api-reference/data#operation/list-exports-views
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.