Skip to content

Commit db17849

Browse files
author
Laurynas Butkus
committed
Add readme instructions
1 parent f7ce83b commit db17849

File tree

1 file changed

+113
-1
lines changed

1 file changed

+113
-1
lines changed

README.md

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,113 @@
1-
# convertapi-python
1+
# ConvertAPI Python Client
2+
3+
[![Build Status](https://secure.travis-ci.org/ConvertAPI/convertapi-python.svg)](http://travis-ci.org/ConvertAPI/convertapi-python)
4+
5+
## Convert your files with our online file conversion API
6+
7+
The ConvertAPI helps converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. And many others files manipulations. In just few minutes you can integrate it into your application and use it easily.
8+
9+
## Installation
10+
11+
Install with [pip](https://pypi.org/project/pip/):
12+
13+
pip install --upgrade convertapi
14+
15+
Install from source with:
16+
17+
python setup.py install
18+
19+
### Requirements
20+
21+
* Python 2.7+ or Python 3.3+
22+
23+
## Usage
24+
25+
### Configuration
26+
27+
You can get your secret at https://www.convertapi.com/a
28+
29+
```python
30+
import convertapi
31+
32+
convertapi.api_secret = 'your api secret'
33+
```
34+
35+
### File conversion
36+
37+
Example to convert file to PDF. All supported formats and options can be found
38+
[here](https://www.convertapi.com).
39+
40+
```python
41+
result = convertapi.convert('pdf', { 'File': '/path/to/my_file.docx' })
42+
43+
# save to file
44+
result.file.save('/path/to/save/file.pdf')
45+
```
46+
47+
Other result operations:
48+
49+
```python
50+
# save all result files to folder
51+
result.save_files('/path/to/save/files')
52+
53+
# get conversion cost
54+
conversion_cost = result.conversion_cost
55+
```
56+
57+
#### Convert file url
58+
59+
```python
60+
result = convertapi.convert('pdf', { 'File': 'https://website/my_file.docx' })
61+
```
62+
63+
#### Specifying from format
64+
65+
```python
66+
result = convertapi.convert(
67+
'pdf',
68+
{ 'File': '/path/to/my_file' },
69+
from_format = 'docx'
70+
)
71+
```
72+
73+
#### Additional conversion parameters
74+
75+
ConvertAPI accepts extra conversion parameters depending on converted formats. All conversion
76+
parameters and explanations can be found [here](https://www.convertapi.com).
77+
78+
```python
79+
result = convertapi.convert(
80+
'pdf',
81+
{
82+
'File': '/path/to/my_file.docx',
83+
'PageRange': '1-10',
84+
'PdfResolution': '150',
85+
}
86+
)
87+
```
88+
89+
### User information
90+
91+
You can always check remaining seconds amount by fetching [user information](https://www.convertapi.com/doc/user).
92+
93+
```python
94+
user_info = convertapi.user()
95+
96+
print(user_info['SecondsLeft'])
97+
```
98+
99+
### More examples
100+
101+
You can find more advanced examples in the [examples/](examples) folder.
102+
103+
## Development
104+
105+
Execute `CONVERT_API_SECRET=your_secret nosetests --nocapture` to run the tests.
106+
107+
## Contributing
108+
109+
Bug reports and pull requests are welcome on GitHub at https://github.com/ConvertAPI/convertapi-python. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
110+
111+
## License
112+
113+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)