Giter Site home page Giter Site logo

artifactory's People

Contributors

adamreid avatar allburov avatar andreydanin avatar chipjust avatar jfaith-impinj avatar jravetch avatar legal90 avatar scopenco avatar zaufi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

artifactory's Issues

Unicode/string issue on Python 2.7

I am running into an issue in artifactory 0.1.17 on python 2.7.14 (32 bit).

The code parsed.append(intern(x)) in pathlib._Flavour.parse_parts() is raising the exception TypeError: intern() argument 1 must be string, not unicode.

I found that this is ultimately due to configparser.ConfigParser.read() in artifactory.read_config() returning unicode strings, but those are never converted via str(s) anywhere.

I was able to workaround this with the following code:

import artifactory
# fix for bug in artifactory module, caused by unicode/str issues
artifactory.read_global_config()
new_config = {}
for section in artifactory.global_config:
    new_config[str(section)] = artifactory.global_config[section]
    artifactory.global_config[section] = None
artifactory.global_config = new_config

Fail in get_stat_json on virtual repository

Hi,

I am trying to upload via the deploy_file method, and i had issue uploading through a virtual repository with error "404, Not found", what does not make sense because i am trying to upload a new file that he shouldn't be exists any way.

So after debugging the error trace back i found that in the API when i try to reach a file is not exists, i had different behavior if it is virtual repo or not;

in regular repository i get this:
{ "errors" : [ { "status" : 404, "message" : "Unable to find item" } ] }

however in the virtual repository i get a different error message:
{ "errors" : [ { "status" : 404, "message" : "Not Found" } ] }

And the library method artifactory.py in get_stat_json (Line 457),
if code == 404 and "Unable to find item" in text:

Which make this condition not working in virtual repository.

Thank you very much.

Double slashes causes inconsistency between open() and exists()

If a path has double slashes (e.g. http://artifactory:8081/artifactory//something/artifact.jar) then, assuming that the artifact does actually exist, ArtifactoryPath.exists() will return True.

However, when open() is called on the same path, it will fail with RuntimeError: 404

Obviously it would make life easier if open() would succeed on such a call, but barring this exists() should fail so that it is possible to check for artifacts without actually trying to open them.

Make ArtifactoryPath iterable

The latest code in pathlib makes Path iterable, using the following code:

    def __iter__(self):
        """Iterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        """
        if self._closed:
            self._raise_closed()
        for name in self._accessor.listdir(self):
            if name in {'.', '..'}:
                # Yielding a path object for these makes little sense
                continue
            yield self._make_child_relpath(name)
            if self._closed:
                self._raise_closed()

I think ArtifactoryPath should implement this interface too

Add AQL support?

AQL is a very important feature of aritfactory.
Why not add its suppport?

No support for Locust performance test tool

When I use the Locust performance test tool (see Locust.io) with the Artifactory Python package it will collect and stats. Other than that works fine.
I am using Locust 1.4.4., WIN7 , 16GB on a VM.

Remove a folder

Hello,

Any way to remove a complete folder?
I am trying using path.unlink() but it is displayed an Operation not Permited error.

Thanks in advance

Compatibility with Python 3.11x

Hello,
According to the PyPI doc the latest python version artifactory 0.1.17 supports is python 3.3.
Does it also supports python 3.11x?
if no, is there any plan of supporting it?

Pip will not install 0.1.14

PyPI shows 0.1.14 available, but only 0.1.13 is able to be installed via pip.

(archtype) C:\Dev\arch>pip install artifactory==45.1.0
Collecting artifactory==45.1.0
  Could not find a version that satisfies the requirement artifactory==45.1.0 (from versions: 0.1, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.6, 0.1.7, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13)
No matching distribution found for artifactory==45.1.0

(archtype) C:\Dev\arch>pip show -f artifactory

---
Metadata-Version: 2.0
Name: artifactory
Version: 0.1.13
Summary: A Python to Artifactory interface
Home-page: http://github.com/parallels/artifactory
Author: Konstantin Nazarov
Author-email: [email protected]
License: MIT License
Location: c:\python\.virtualenvs\archtype\lib\site-packages
Requires: requests, python-dateutil, pathlib
Classifiers:
  Development Status :: 3 - Alpha
  Intended Audience :: Developers
  License :: OSI Approved :: MIT License
  Operating System :: OS Independent
  Programming Language :: Python :: 3
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3.2
  Programming Language :: Python :: 3.3
  Topic :: Software Development :: Libraries
  Topic :: System :: Filesystems
Files:
  __pycache__\artifactory.cpython-35.pyc
  artifactory-0.1.13.dist-info\DESCRIPTION.rst
  artifactory-0.1.13.dist-info\METADATA
  artifactory-0.1.13.dist-info\RECORD
  artifactory-0.1.13.dist-info\WHEEL
  artifactory-0.1.13.dist-info\metadata.json
  artifactory-0.1.13.dist-info\top_level.txt
  artifactory.py

Multiple Layouts for Debian Packages

You can specify multiple layouts when uploading packages, i.e.

pool/libatk1.0_i386.deb;deb.distribution=precise;deb.distribution=trusty;deb.component=main;deb.component=contrib;deb.architecture=i386;deb.architecture=64bit-arm

Can we please support this?

document relation with existing python artifactory library: Party

It would be great if you could document the differences between this libary and the other existing one namd Party - https://pypi.python.org/pypi/Party/

How do they compare, pros, cons, maybe policy regarding accepting contributions.

I am asking this because I do want to pick one and probably I will want to contribute to it and I want to make a good pick and not having to maintain my own fork. As a side not, on open-source world is good to document about "competition" :)

Example doesn't work as expected

I'm trying to use this module using the following trivial code (taken from examples):

#!/usr/bin/env python3
import artifactory
path = artifactory.ArtifactoryPath('https://mycompany.artifactoryonline.com/mycompany/some-repo')
for p in path:
    print(p)

Note, we use JFrog Artifactory as a SaaS. Without any config file (i.e. ~/.artifactory_python.cfg) it gives me the following error:

Traceback (most recent call last):
File "./a.py", line 7, in <module>
    for p in path:
File "/work/GitHub/artifactory/artifactory.py", line 990, in __iter__
    for name in self._accessor.listdir(self):
File "/work/GitHub/artifactory/artifactory.py", line 546, in listdir
    stat = self.stat(pathobj)
File "/work/GitHub/artifactory/artifactory.py", line 492, in stat
    jsn = self.get_stat_json(pathobj)
File "/work/GitHub/artifactory/artifactory.py", line 467, in get_stat_json
    cert=pathobj.cert)
File "/work/GitHub/artifactory/artifactory.py", line 415, in rest_get
    cert=cert)
File "/usr/lib64/python3.5/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
File "/usr/lib64/python3.5/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
File "/usr/lib64/python3.5/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
File "/usr/lib64/python3.5/site-packages/requests/sessions.py", line 590, in send
    adapter = self.get_adapter(url=request.url)
File "/usr/lib64/python3.5/site-packages/requests/sessions.py", line 672, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for '/api/storage/https:/mycompany.artifactoryonline.com/mycompany/some-repo'

If I'm going to add the config file:

[https://mycompany.artifactoryonline.com/mycompany/]
username = myuser
password = mypass
verify = false

it throws another error:

Traceback (most recent call last):
File "./a.py", line 7, in <module>
    for p in path:
File "/work/GitHub/artifactory/artifactory.py", line 990, in __iter__
    for name in self._accessor.listdir(self):
File "/work/GitHub/artifactory/artifactory.py", line 546, in listdir
    stat = self.stat(pathobj)
File "/work/GitHub/artifactory/artifactory.py", line 492, in stat
    jsn = self.get_stat_json(pathobj)
File "/work/GitHub/artifactory/artifactory.py", line 464, in get_stat_json
    str(pathobj.relative_to(pathobj.drive)).strip('/')])
File "/work/GitHub/artifactory/artifactory.py", line 929, in relative_to
    obj = super(ArtifactoryPath, self).relative_to(*other)
File "/usr/lib64/python3.5/pathlib.py", line 864, in relative_to
    .format(str(self), str(formatted)))
ValueError: 'https://mycompany.artifactoryonline.com/mycompany/some-repo/' does not start with 'https:/mycompany.artifactoryonline.com/mycompany'

I would really appreciate if someone point me on my mistake, but actually I think it is a bug…

PS. As one may notice, I'm using Python 3.5, with pathlib builtin.

Help us improve README.md

If you are a native english speaker and seek to help this project, you can always help by improving the README.md file.

Both the introduction text and the walkthrough section require some work.

Download artifacts not saving binaries

trying to download an artifact with the example provided in the README downloads a file that contains a text like this:

{
  "var1" : "value1",
  "var2" : "value2",
  "created" : "2018-01-03T15:59:24.432Z",
  "createdBy" : "svc-olp-acf",
  "lastModified" : "2018-01-03T15:59:24.283Z",
  "modifiedBy" : "svc-olp-acf",
  "lastUpdated" : "2018-01-03T15:59:24.283Z",
  "downloadUri" : "uri",
  "mimeType" : "mime/type",
  "size" : "2485",
  "checksums" : {
    "sha1" : "764...",
    "md5" : "b1f50..."
  },
  "originalChecksums" : {
    "sha1" : "764d3648..",
    "md5" : "b1f50b84.."
  },
  "uri" : "https://artifact/url"
}

but not actually a pom, jar or zip
i'm using python 3.6.3

Path being manipulated at class instance

from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://mytest.repository.com/mytestdir")

path.mkdir() --> fails. Path string in ArtifactoryPath object is "http:/mytest.respository.com/mytestdir" . The additional "/" after http:/ has been removed by the utility.
This is latest released version. Tested on both Windows and Linux - same result.

Cleanup relative_to slashes

Everywhere we use relative_to there is some form of stripping the '/' character happening. In some places we rstrip. Is some places we strip. In some places we slice arrays to strip.

This should at least be consistent. A good way is to move the strip into relative_to and remove it from all the caller's code. This would define the interface to be relative_to always returns a path without a leading or trailing '/' character.

If you approve, I can do this.

Build Info Support

This is more of a question than an issue.

Artifactory has a Builds tab for each artifact that shows you where it came from. Normally, if I use a Jenkins Artifactory plugin to push to Artifactory, then this tab is populated with relevant build information.

However, when I use this library to deploy files, I don't see anything under the Builds tab. Does this library support populating build info fields? If so, how and if not, how do I go about doing so using my deploy script?

Example of empty Builds tab:

image

Build Info documentation page is located here

Deprecation warning due to invalid escape sequences in Python 3.7

Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/

find . -iname '*.py' | grep -Ev 'example|utl|samples|deps' | xargs -P 4 -I{} python3.8 -Wall -m py_compile {} 
./test.py:36: DeprecationWarning: invalid escape sequence \,
  self.assertEqual(s, "a\,b\|c\=d")
./test.py:46: DeprecationWarning: invalid escape sequence \|
  self.assertEqual(s, "baz=ba\\r,qu\|ux|foo=a\,s\=df")

Add possibility to get authentication information from global config

There should be a config file that looks like this:

[artifactory-instance.com/artifactory]
username = deployer
password = ilikerandompasswords

[another-artifactory-instance.com/artifactory]
username = foo
password = @dmin

And then, when one instantiates ArtifactoryPath with url starting from what's in the config, authentication information should be picked up automatically.

The config should be called ~/.artifactory_python.cfg

is_file() raises when the artifacts' name contains square brackets

The following exception is raised when is_file() method is called for an artifact where its name contains square branckets ('[' or ']'):

if artifact.is_file():

File "C:\Python37-32\lib\site-packages\artifactory.py", line 1035, in is_file
return self._accessor.is_file(self)
File "C:\Python37-32\lib\site-packages\artifactory.py", line 534, in is_file
stat = self.stat(pathobj)
File "C:\Python37-32\lib\site-packages\artifactory.py", line 492, in stat
jsn = self.get_stat_json(pathobj)
File "C:\Python37-32\lib\site-packages\artifactory.py", line 471, in get_stat_json
raise RuntimeError(text)
RuntimeError: {
"errors" : [ {
"status" : 400,
"message" : "Bad Request"
} ]
}

can't compatible with configparser

the library depends on pathlib, but it seems can't work if configparser installed.

File "xxxxx/lib/python2.7/site-packages/artifactory.py", line 311, in parse_parts
drv, root, parsed = super(_ArtifactoryFlavour, self).parse_parts(parts)
File "xxxxx/lib/python2.7/site-packages/pathlib.py", line 90, in parse_parts
parsed.append(intern(x))
TypeError: intern() argument 1 must be string, not unicode

document relation with existing python artifactory library: Party

It would be great if you could document the differences between this libary and the other existing one namd Party - https://pypi.python.org/pypi/Party/

How do they compare, pros, cons, maybe policy regarding accepting contributions.

Maybe a small note in the README and the package homepage from PyPi?

I am asking this because I do want to pick one and probably I will want to contribute to it and I want to make a good pick and not having to maintain my own fork. As a side not, on open-source world is good to document about "competition" :)

Python 3.6 compatibility; Path.glob()

Hi,

It appears that globbing behavior in Pathlib has changed/optimized to use scandir in 3.6: https://bugs.python.org/issue26032

  File "/usr/lib/python3.6/pathlib.py", line 1081, in glob
    for p in selector.select_from(self):
  File "/usr/lib/python3.6/pathlib.py", line 489, in select_from
    scandir = parent_path._accessor.scandir
AttributeError: '_ArtifactoryAccessor' object has no attribute 'scandir'

Trivially implementing scandir on _ArtifactoryAccessor results in a second failure, so this may be more than just adding a new method that wraps listdir.

Is this repo abandoned?

The latest release (0.1.17) was Mar 12, 2016.
The latest commit to the master branch was Oct 23, 2016.
It's not completely clear who has permission to merge PRs or close issues, but it seems to me like no such person has commented on any PRs or issues in several months.

Please close this issue if this repo is not abandoned.

Generating different URL than specified

First off, I don't know if this is an Artifactory issue or something that is happening when using this library.

But when I am specifying the artifact url such as https://myartifactory.com/artifactory/libs-snapshot-local/path/to/amp/version/amp-version-SNAPSHOT it ends up giving me an error and saying it cannot find the file -- https://myartifactory.com/artifactory/api/storage/libs-snapshot-local/path/to/amp/version/amp-version-SNAPSHOT. This has the string api/storage inserted into it.

I can't figure out if this is something that our artifactory server is re-routing the request to or if it is something with the Artifactory lib.

API Key

It would be great if this supported the API key in addition to username/pw

Way to delete/remove file?

Is there a way to delete a file in Artifactory? I'm currently trying to update a file that exists but upon upload I'm getting an error stating the file exists:

[Errno 17] File exists

I saw the 'unlink' method on the _ArtifactoryAccessor class, but that is a private class.

Can not connect using config file

I have created config file and put it in to the home directory. Every time I try to run my script I got following message:
RuntimeError: {
"errors" : [ {
"status" : 404,
"message" : "{"error":"Item artifactory_item-local:api/storage does not exist"}"
} ]
}

I checked twice and the url address of Artifactory is correct when I use it with my browser.

cannot deploy file with calc_md5=False,calc_sha1=False

relrepo.deploy_file(os.path.join(".",art),calc_md5=False,calc_sha1=False)
File "/usr/local/lib/python2.7/dist-packages/artifactory.py", line 1092, in deploy_file
target.deploy(fobj, md5, sha1, parameters)
UnboundLocalError: local variable 'md5' referenced before assignment

since md5 and sha1 is not initialized

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.