forked from indymedia/epicyon
Set user agent for commands
parent
dac9f1f5f8
commit
8d6a1e2ffe
|
@ -844,7 +844,7 @@ if args.actor:
|
||||||
if nickname==domain:
|
if nickname==domain:
|
||||||
personUrl=personUrl.replace('/users/','/actor/')
|
personUrl=personUrl.replace('/users/','/actor/')
|
||||||
#print('personUrl: '+personUrl)
|
#print('personUrl: '+personUrl)
|
||||||
personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,domain)
|
personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,None)
|
||||||
if personJson:
|
if personJson:
|
||||||
pprint(personJson)
|
pprint(personJson)
|
||||||
else:
|
else:
|
||||||
|
@ -854,7 +854,7 @@ if args.actor:
|
||||||
if args.json:
|
if args.json:
|
||||||
session = createSession(domain,port,True)
|
session = createSession(domain,port,True)
|
||||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
testJson = getJson(session,args.json,asHeader,None,__version__,httpPrefix,domain)
|
testJson = getJson(session,args.json,asHeader,None,__version__,httpPrefix,None)
|
||||||
pprint(testJson)
|
pprint(testJson)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ def getJson(session,url: str,headers: {},params: {}, \
|
||||||
if params:
|
if params:
|
||||||
sessionParams=params
|
sessionParams=params
|
||||||
pythonVersion=str(sys.version_info[0])+'.'+str(sys.version_info[1])+'.'+str(sys.version_info[2])
|
pythonVersion=str(sys.version_info[0])+'.'+str(sys.version_info[1])+'.'+str(sys.version_info[2])
|
||||||
sessionHeaders['User-Agent']='Epicyon/'+version+'; +'+httpPrefix+'://'+domain+'/'
|
sessionHeaders['User-Agent']='Epicyon/'+version
|
||||||
|
if domain:
|
||||||
|
sessionHeaders['User-Agent']+='; +'+httpPrefix+'://'+domain+'/'
|
||||||
#"Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5)"
|
#"Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5)"
|
||||||
if not session:
|
if not session:
|
||||||
print('WARN: no session specified for getJson')
|
print('WARN: no session specified for getJson')
|
||||||
|
|
Loading…
Reference in New Issue