Upload packages to Nexus repository using python scripts

Hello,

I am trying to upload packages (APT,YUM,PYPI,RAW,DOCKER) to nexus using python. I have only find a way to upload maven packages. I would like to upload some other formats of packages using similar scripts as below example for maven.

import requests
params = (
(‘repository’, ‘maven-releases’),
)
files = {
‘maven2.groupId’: (None, ‘com.example’),
‘maven2.artifactId’: (None, ‘test-app’),
‘maven2.version’: (None, ‘1.0.0’),
‘maven2.asset1’: (‘example.json’, open(‘example.json’, ‘rb’)),
‘maven2.asset1.extension’: (None, ‘json’),
}
response = requests.post(‘http://localhost:8081/service/rest/v1/components’, params=params, files=files, auth=(‘admin’, ‘admin123’))

Here is example for uploading raw packages with python script.
import requests
params = (
(‘repository’, ‘hosted-raw’), #repository name
)
files = {
‘raw.asset1’: (‘package.tar.gz’)
}
data = {
‘raw.directory’: (‘packages/raw/’),
‘raw.asset1.filename’: (‘package.tar.gz’)
}
response = requests.post(‘http://localhost:8081/service/rest/v1/components’, params=params, files=files, data=data, auth=(‘admin’, ‘admin123’))

I still have problem with apt and yum packages