Download files from the Cencora secure file transfer site
Project description
Purpose
This Python package can be used to download files from the Cencora (formerly Amerisource) secure file transfer site for ingest into clinical data systems.
Downloads are performed from the web-based secure site located at https://secure.amerisourcebergen.com/. FTP is not supported. (There are many easier ways to automate FTP-based downloads.)
Requirements
- Python 3.10 or newer
Installation
Use pip to install the medberg package.
pip install medberg
Usage
Import the SecureSite class from the medberg module.
from medberg import SecureSite
Initialize a connection to the secure site by providing a username and password.
con = SecureSite(username='yourname', password='yourpassword')
A list of files is automatically downloaded at connection time. Filenames are stored as
a list in the files
variable.
print(con.files)
# ['039A_012345678_0101.TXT', '077AXM0123456780101.TXT', ...]
Any individual file can be downloaded using the get_file
method.
con.get_file('039A_012345678_0101.TXT', save_dir='C:\\Users\\yourname\\Downloads\\')
The file is saved in the path specified by save_dir
. If this is left blank, it will
default to the current working directory. The local filepath will be returned as a
pathlib Path.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
This software is licensed under the MIT License.
Disclaimer
This package and its authors are not afiliated, associated, authorized, or endorsed by Cencora, Inc. All names and brands are properties of their respective owners.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file medberg-0.0.1.tar.gz
.
File metadata
- Download URL: medberg-0.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9e9f198c4b1a98f212bbc911aed158b21e4f530f3b7d143bd88ab4f944cde02 |
|
MD5 | 7d01ebc25096eb1315e73a71ea2811c3 |
|
BLAKE2b-256 | de4c0cb1d5c5698e4ea0ed5d229c2268aa127b9d498331e5f5556b87c9c2eb5d |
File details
Details for the file medberg-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: medberg-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602607c6a0198d11327bae3fb5907ec005062c64c8c3a73c2e23e5bfe8e1ab4c |
|
MD5 | eea756803d22169f559b560b5887690e |
|
BLAKE2b-256 | f683e3cf9977d1ccbad4187e7411266adb3c851be9d4aa0d5c452c07cd12fcc1 |