Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	_config.yml
  • Loading branch information
allburov committed Jan 15, 2018
2 parents a5fe4c6 + 6720c8c commit 35c6a10
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 145 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ language: python
python:
- '3.5'
- '2.7'
before_install:
- sudo apt-get install pandoc
install:
- pip install -r requirements.txt
- pip install pypandoc
- pip install python-dateutil requests pathlib
script: python test.py
deploy:
provider: pypi
Expand Down
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ path = ArtifactoryPath(
path.touch()
```

## Session ##

To re-use the established connection, you can pass ```session``` parameter to ArtifactoryPath:

```python
from artifactory import ArtifactoryPath
import requests
ses = requests.Session()
ses.auth = ('username', 'password')
path = ArtifactoryPath(
"http://my-artifactory/artifactory/myrepo/my-path-1",
sesssion=ses)
path.touch()

path = ArtifactoryPath(
"http://my-artifactory/artifactory/myrepo/my-path-2",
sesssion=ses)
path.touch()
```


## SSL Cert Verification Options ##
See [Requests - SSL verification](http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification) for more details.

Expand Down Expand Up @@ -137,3 +158,41 @@ cert = ~/mycert
```

Whether or not you specify ```http://``` or ```https://``` prefix is not essential. The module will first try to locate the best match and then try to match URLs without prefixes. So if in the config you specify ```https://my-instance.local``` and call ```ArtifactoryPath``` with ```http://my-instance.local```, it will still do the right thing.

# Artifactory AQL #

Supported [Artifactory-AQL](https://www.jfrog.com/confluence/display/RTF/Artifactory+Query+Language)

```python
from artifactory import ArtifactoryPath
aql = ArtifactoryPath( "http://my-artifactory/artifactory") # path to artifactory, NO repo

# dict support
artifacts = aql.aql("items.find", {"repo": "myrepo"}) # send query: items.find({"repo": "myrepo"})

# list support
artifacts = aql.aql("items.find()", ".include", ["name", "repo"]) # send query: items.find().include("name", "repo")

# support complex query
args = ["items.find", {"$and": [
{
"repo": {"$eq": "repo"}
},
{
"$or": [
{"path": {"$match": "*path1"}},
{"path": {"$match": "*path2"}},
]
},
]
}]

# send query:
# items.find({"$and": [{"repo": {"$eq": "repo"}}, {"$or": [{"path": {"$match": "*path1"}}, {"path": {"$match": "*path2"}}]}]})
# artifacts_list contains raw data (list of dict)
artifacts_list = aql.aql(*args)

# You can convert to patlib object:
artifact_pathlib = map(aql.from_aql, artifacts_list)
artifact_pathlib_list = list(map(aql.from_aql, artifacts_list))
```
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-hacker
theme: jekyll-theme-cayman
Loading

0 comments on commit 35c6a10

Please sign in to comment.