forked from freelancer/freelancer-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_user_jobs.py
More file actions
30 lines (24 loc) · 755 Bytes
/
add_user_jobs.py
File metadata and controls
30 lines (24 loc) · 755 Bytes
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
from freelancersdk.resources.users import add_user_jobs
from freelancersdk.session import Session
from freelancersdk.exceptions import UserJobsNotAddedException
import os
def sample_add_user_jobs():
url = os.environ.get('FLN_URL')
oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
session = Session(oauth_token=oauth_token, url=url)
user_jobs_data = {
'job_ids': [
20, 32
]
}
try:
m = add_user_jobs(session, **user_jobs_data)
except UserJobsNotAddedException as e:
print(('Error message: %s' % e.message))
print(('Server response: %s' % e.error_code))
return None
else:
return m
m = sample_add_user_jobs()
if m:
print(("User jobs added: %s" % m))