forked from freelancer/freelancer-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_bids.py
34 lines (28 loc) · 844 Bytes
/
get_bids.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from freelancersdk.session import Session
from freelancersdk.resources.projects.projects import get_bids
from freelancersdk.resources.projects.exceptions import \
BidsNotFoundException
import os
def sample_get_bids():
url = os.environ.get('FLN_URL')
oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
session = Session(oauth_token=oauth_token, url=url)
get_bids_data = {
'project_ids': [
101,
102,
],
'limit': 10,
'offset': 0,
}
try:
b = get_bids(session, **get_bids_data)
except BidsNotFoundException as e:
print('Error message: {}'.format(e.message))
print('Server response: {}'.format(e.error_code))
return None
else:
return b
b = sample_get_bids()
if b:
print('Found bids: {}'.format(len(b['bids'])))