Kodi Community Forum

Full Version: How get the real XBMC user-agent value?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Actually, when a XBMC python add-on is accessing an internet server (using urllib or urllib2) the user agent used is Python-urllib/2.7. The user agent could always been modified using urllib, but how could we get the real XBMC user-agent value from XBMC? Or, is their a way to rebuilt it?
I don't know that there is in fact a single "real" XBMC user-agent value for XBMC.

For example the XBMC debug log add-on has the following code:

Code:
ADDON_TITLE = addon.getAddonInfo('name')
ADDON_VERSION = addon.getAddonInfo('version')

headers = {'User-Agent': '%s-%s' % (ADDON_TITLE, ADDON_VERSION)}

Is this what you are asking about?
Thank you, but no. That the opposite that I want. I want to be able to send something like this :

Code:
User-Agent: XBMC/13.0-ALPHA3 Git:20130430-e8fe5cf (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)

through headers by using urlllib. But not a fake XBMC user-agent value. The real XBMC user-agent value of the system.
Was this ever solved?
Why bother? Send whatever User-Agent string you like. Or note the pattern and construct User-Agent based on that pattern. Kodi version can be extracted via 'System.BuildVersion' info-label.
(2015-12-21, 21:02)wsnipex Wrote: [ -> ]https://github.com/xbmc/xbmc/pull/8643

Great! this works on Krypton, here is an example:

Code:
import xbmc
real_user_agent = xbmc.getUserAgent()
print real_user_agent
Is there a Jarvis equivalent to xbmc.getUserAgent() ?

Trying to get android os details of any system.
nope