arthurg / kijiji-repost-headless Goto Github PK
View Code? Open in Web Editor NEWRepost / Post Kijiji ads with Python
License: MIT License
Repost / Post Kijiji ads with Python
License: MIT License
george@web64-nginx:~/kijiji_repost_headless$ python3 generate_inf_file.py
Traceback (most recent call last):
File "generate_inf_file.py", line 7, in
from posting_category import *
File "/home/george/kijiji_repost_headless/posting_category.py", line 68
return {**leafCategory, **(get_category_map(session, newBranches, False))}
^
SyntaxError: invalid syntax
Same for repost_folder (not working) and folder (working) commands.
[root@centos7 battery.01]# python3.6 /root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py -u uuuuuuuuu -p ppppppp repost myAd.inf
Traceback (most recent call last):
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 134, in
main()
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 55, in main
args.function(args)
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 112, in repost_ad
api.delete_ad_using_title(delAdName)
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_api.py", line 118, in delete_ad_using_title
allAds = self.get_all_ads()
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_api.py", line 160, in get_all_ads
myAdsTree = json.loads(myAdsPage.text)
File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[ad deleted manually in between]
[root@centos7 battery.01]# python3.6 /root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py -u uuuuuuuuu -p ppppppp post myAd.inf
Image Upload success on try #1
[root@centos7 battery.01]# python3.6 /root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py -u uuuuuuuuu -p ppppppp show
Traceback (most recent call last):
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 134, in
main()
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 55, in main
args.function(args)
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 90, in show_ads
[print("{} '{}'".format(adId, adName)) for adName, adId in api.get_all_ads()]
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_api.py", line 160, in get_all_ads
myAdsTree = json.loads(myAdsPage.text)
File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[root@centos7 battery.01]#
Gives weird results when generating the inf. Searching for 'other' also gives many categories with just other.
As of Nov 1, 2017's build (after this build, it works with this version), reposting from folders does not work.
Example command with current build:
python kijiji_repost_headless repost_folder KIJIJI-ADS/1-CVAIO
Output:
usage: kijiji_repost_headless [-h] [-u USERNAME] [-p PASSWORD]
{post,folder,repost_folder,show,delete,nuke,check_ad,repost,build_ad}
...
Post ads on Kijiji
positional arguments:
{post,folder,repost_folder,show,delete,nuke,check_ad,repost,build_ad}
sub-command help
post post a new ad
folder post ad from folder
repost_folder post ad from folder
show show currently listed ads
delete delete a listed ad
nuke delete all ads
check_ad check if ad is active
repost repost an existing ad
build_ad Generates the item.inf file for a new ad
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
username of your kijiji account
-p PASSWORD, --password PASSWORD
password of your kijiji account
Example Output With Nov 1 Build (same command):
Existing ad deleted before reposting
Image Upload success on try #1
Image Upload success on try #1
Image Upload success on try #1
Image Upload success on try #1
Image Upload success on try #1
Image Upload success on try #1
Image Upload success on try #1
In kijiji_api.py
in the post_ad_using_data()
function definition after getting response from posting page to scrape the token, the token regex is not found.
this runs fine:
resp = self.session.get('https://www.kijiji.ca/p-admarkt-post-ad.html?categoryId=773')
token_regex = r"initialXsrfToken: '\S+'"
Now you search this regex in the response string:
image_upload_token = re.findall(token_regex, resp.text)[0].strip("initialXsrfToken: '").strip("'")
the above produced error:
Traceback (most recent call last):
File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\soft\xampp\htdocs\qltm\Kijiji-Repost-Headless\kijiji_repost_headless\
__main__.py", line 220, in <module>
main()
File "C:\soft\xampp\htdocs\qltm\Kijiji-Repost-Headless\kijiji_repost_headless\
__main__.py", line 58, in main
args.function(args)
File "C:\soft\xampp\htdocs\qltm\Kijiji-Repost-Headless\kijiji_repost_headless\
__main__.py", line 109, in post_ad
post_out=api.post_ad_using_data(data, imageFiles)
File "C:\soft\xampp\htdocs\qltm\Kijiji-Repost-Headless\kijiji_repost_headless\
kijiji_api.py", line 164, in post_ad_using_data
text_file.write(item)
File "c:\python36\lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xe7' in position 0:
character maps to <undefined>
I saved the resp.text
object to a file to examine the response manually:
text_file = open("output.txt", "w")
print(type(resp.text))
for item in resp.text:
text_file.write(item)
text_file.close()
I don't see an occurance of initialXsrfToken
in the response text/ I have attached the file here.
output.txt
I have tried logging into the same account manually using Chrome browser and visitting https://www.kijiji.ca/p-admarkt-post-ad.html?categoryId=773
. And it returns initialXsrfToken
there if I explore elements.
This happens repeatedly. Its not random. I can't get it to work. I tried different blank accounts as well.
Any thoughts?
Tried to submit AD, but can't , here is stack trace. Related to image upload:
Note: A recent update has broken all previously generated .inf files. Please regenerate all your files - this script is not backwards compatible with previous versions. The commands are also changed. See README for details.
Image upload success on try #1
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "kijiji_repost_headless/__main__.py", line 184, in <module>
main()
File "kijiji_repost_headless/__main__.py", line 50, in main
args.function(args)
File "kijiji_repost_headless/__main__.py", line 91, in post_ad
api.post_ad_using_data(data, image_files)
File "kijiji_repost_headless/kijiji_api.py", line 201, in post_ad_using_data
raise KijijiApiException("Could not post ad.", resp.text)
kijiji_api.KijijiApiException: Could not post ad.
Scrape the existing ad and build the item file. This allows people to use the kijiji composer if they wish. This also allows reposting before the time has expired.
Kijiji currently has a limit of 8 ads in a given category. If you can delete ads automatically, you can rotate ads. E.g. You post one a day. Once you get to 8 ads you delete the oldest one and post a new one.
trying to run build_ad command and keep receiving this error... sorry for n3wb question.
LOG:
C:\Users\Erich\Desktop\kijiji ads\Kijiji-Repost-Headless-master>python kijiji_repost_headless build_ad
Traceback (most recent call last):
File "C:\Users\Erich\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Erich\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "kijiji_repost_headless\__main__.py", line 196, in <module>
main()
File "kijiji_repost_headless\__main__.py", line 55, in main
args.function(args)
TypeError: generate_inf_file() takes 0 positional arguments but 1 was given
getting this error text when using the post command after having built inf file and img is in the same directory as it. obviously my actual usr+pw used.
>>python kijiji_repost_headless -u (username) -p (password) post item.inf
Traceback (most recent call last):
File "C:\Users\erich\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Erich\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "kijiji_repost_headless\__main__.py", line 196, in <module>
main()
File "kijiji_repost_headless\__main__.py", line 55, in main
args.function(args)
File "kijiji_repost_headless\__main__.py", line 96, in post_ad
while not check_ad(args) and attempts < 5:
File "kijiji_repost_headless\__main__.py", line 177, in check_ad
all_ads = api.get_all_ads()
File "kijiji_repost_headless\kijiji_api.py", line 213, in get_all_ads
user_id = get_kj_data(resp.text)['config']['userId']
KeyError: 'userId'
I run ads in 3 cities. Be nice if the city was one of the settable fields.
It would be nice to be able to generate the INF from an already existing Kijiji ad that you posted using other means, such as the mobile app.
1.The usage description in the README file is incorrect. Must be done using the command:
" python KijijiCmd.py -u (username) -p (password) [command] "
instead of
" python KijijiCmd.py -u [command] (username) -p (password) "
Hi, as @GuoArthur asked, I tried something to get all the attributes needed to post an ad. Not just for room renting or house selling, but for any ad. The data gets saved into a dictionary.
For now, it's just a proof-of-concept, but we could save this dictionary into a json file. This way, we wouldn't even need a database anymore.
Have a look here: https://github.com/StefGou/Kijiji-Repost-Headless/blob/attributes/kijiji_repost_headless/save_attribute_map_to_json.py
Please, give me some feedback and your thoughts.
I cannot post any ad because this exception shows up :
requests.exceptions.HTTPError: 500 Server Error: for url: https://www.kijiji.ca/my/ranks
I'm a little new to programming so I apologize in advance if this is very simple. Thanks for your help!
Having this error since around 1400h this afternoon.
Prior to this everything had been working well for months without any issues.
"Element with name attribute 'userId' not found in html text"
Thrown from:
raise KijijiApiException("Element with name attribute '{}' not found in html text.".format(attrib_name), html)
in
def get_token(html, attrib_name)
It stopped working today at 9am
Existing ad deleted before reposting
401
Traceback (most recent call last):
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 155, in
main()
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 48, in main
args.function(args)
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 142, in repost_ folder
repost_ad(args)
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 134, in repost_ ad
post_ad(args)
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_cmd.py", line 88, in post_ad
api.post_ad_using_data(data, imageFiles)
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_api.py", line 154, in post_ad using_data
imageList = self.upload_image(image_upload_token, imageFiles)
File "/root/Kijiji-Repost-Headless-master/kijiji_repost_headless/kijiji_api.py", line 132, in upload image
imageTree = json.loads(r.text)
File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
How can I extract the ad page numbers from JSON?
Preferably all of them in a single list object.
I'm not super familiar with JSON stuff at all.
Thanks
Somehow kijiji only escapes the first line, resulting no blank line being created. But after the ad is posted and if I click on Edit Ad and save changes without actually changing anything the blank line space will show up.
Is there a workaround for this?
Did something in the back-end change? The code was working 100% as of this morning, but when I came back this afternoon I am no longer able to post ads, only delete them, or show them. I changed nothing whatsoever on my side.
In upload_one_image(imgFile)
, the value of r.status_code
is 401 and not 200 and the error is thrown.
Error 401 is "Unauthorized: Access is denied due to invalid credentials"
Yet clearly I can log in and show my ads, or delete them through the API, as well as manually, with the exact same credential info. Earlier on I did try to post to another account (and rememberMe
in login(self, username, password)
is set to True and also on. I wonder if there's some conflict with a cookie or something? I admit, I don't really know what I'm talking about, here, and defer to your expertise.
Is anyone else having problems posting?
Hi, I'm new to this bot. I spent a few hours trying to figure this out. I was able to install the requirements and build my ad, but when it comes to posting, reposting, or even showing I keep getting this message. Here is an example of the error I get when trying to use the show command. I just downloaded all of the files when I started a few hours ago, so I'm pretty sure everything is good in terms of updates.
python3 kijiji_repost_headless [-u USERNAME] [-p PASSWORD] show
Note: A recent update has broken all previously generated .inf files. Please regenerate all your files - this script is not backwards compatible with previous versions. The commands are also changed. See README for details.
usage: kijiji_repost_headless [-h] [-u USERNAME] [-p PASSWORD]
{post,show,delete,nuke,check_ad,repost,build_ad}
...
kijiji_repost_headless: error: invalid choice: '[-u' (choose from 'post', 'show', 'delete', 'nuke', 'check_ad', 'repost', 'build_ad')
Last night my Ohio AWS web server which posts about 5ads/day over night could not post. Tested a few ips over VPN and all US IPs seems to be banned (at least I get a token not found error) Just a heads up
Because of the 8 free ad in any one category, being able to support multiple users. E.g. I use ID 1 for 8 ads, and ID 2 for 8 ads.
Hi, I saw in your TODO that you would like your files to be reorganized like a standard module.
I'd be glad to give it a go if you don't mind?
I'm seeking for small tasks that I can handle as a beginner. If you want me to do anything, just ask! :)
Hey guys,
When I make a post I get the following error.
`Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "kijiji_repost_headless/main.py", line 196, in
main()
File "kijiji_repost_headless/main.py", line 55, in main
args.function(args)
File "kijiji_repost_headless/main.py", line 96, in post_ad
while not check_ad(args) and attempts < 5:
File "kijiji_repost_headless/main.py", line 177, in check_ad
all_ads = api.get_all_ads()
File "kijiji_repost_headless/kijiji_api.py", line 216, in get_all_ads
my_ads_tree = json.loads(my_ads_page.text)
File "/usr/lib/python3.4/json/init.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)`
I searched through past issues and it seemed like previously people were getting this error on image upload, however, I'm getting this on posting of ad. The script does not throw any 401 errors.
Any ideas? thanks
While kijiji has a 10 second between posts requirement, as automaters get better, they will get wise to this. I suggest a user setable time between posts, and a random window. E.g. 5 minutes, +- 1 minute.
Hey guys, what's the added benefit of using the new version of the program? Just wondering.
Thanks,
Tried posting an ad with the latest kijiji_api.py and got a token error. Reverted back to kijiji_api.py before the token fix and it works fine.
postAdForm.attributeMap[motorcyclesmake_s]=honda
postAdForm.attributeMap[motorcyclesmake_s+motorcyclesmodel_s]=othrmdl
should be
postAdForm.attributeMap[motorcyclesmake_s]=honda
postAdForm.attributeMap[motorcyclesmodel_s]=othrmdl
otherwise the ad won't be added, you'll get
kijiji_api.PostAdException: Could not post ad.
I'm building a cms on top of this and I'm currently struggling to find the best way to get the ad id back after creating a new ad
I need this in order to be able to delete it and perhaps track it over time or confirm it's status
i'm sure this is something others have had to do.. ideally if the script could output the ID after posting/reposting an ad that would be great as I could capture it and store it in my db
I add postAdForm.phoneNumber=
myself in the item.inf
but maybe you could ask that info when generating the inf file?
Hi,
When creating an item.enf file for a car, it asks for the make, and when the make is entered it asks for the model but the choices are:
1 G80
2 G90
What does this stand for? Thanks
Hi there, I'm using the very last version and am running into a decoding issue.
I am using French accents in my title/description. I thought that was fixed according to another issue but I'm still having problems.. here's the traceback
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/kijiji_post_headless/__main__.py", line 195, in <module>
main()
File "/kijiji_post_headless/__main__.py", line 55, in main
args.function(args)
File "/kijiji_post_headless/__main__.py", line 87, in post_folder
post_ad(args)
File "/kijiji_post_headless/__main__.py", line 94, in post_ad
[data, imageFiles] = get_inf_details(args.inf_file)
File "/kijiji_post_headless/__main__.py", line 76, in get_inf_details
data = {key: val for line in infFileLines for (key, val) in (line.strip().split("="),)}
File "/kijiji_post_headless/__main__.py", line 76, in <dictcomp>
data = {key: val for line in infFileLines for (key, val) in (line.strip().split("="),)}
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 736: ordinal not in range(128)
i'm using python3. I thought python3 handles UTF8 decoding better than before as it's built-in to str function now? but I see that on line 76 where the problem is occuring
data = {key: val for line in infFileLines for (key, val) in (line.strip().split("="),)}
you are doing some kind of direct assignment which may cause the problem?
another thing I noticed with the latest version is that after it's done uploading a new ad (when using a folder to post at least) it doesn't exit.. it just hangs there and I have to ctrl-c to get out
and lastly as others have reported I'm also getting a lot of random 401s and failed image.. but it works like 75% of the time
When I create ad text and create a newline by pressing enter it creates it as a \n in the .inf file, which seems to be fine, except it posts it as a literal "\n". So it makes an ad like: "This is my first line\n\nThis is my second line"
The weird thing is, I don't think it did this originally, but I can't remember if that was really the case or not.
It's a great script, so thanks so much for writing it!
I know this is a bit out of scope but just thought I'd ask to see if maybe you're already aware of something that works well for this purpose
basically i'm going to be doing a lot of queries from a single server with static ip and want to avoid getting blacklisted. Can you recommend a service and a package (in python I imagine) that would wrap your kijiji-repost-headless well and easily?
thanks!!
Hello,
Lately been getting login issue when trying to post using either the "post" "folder" or "nuke" command.
here is the trace followed by an html return:
Traceback (most recent call last):
File "../KijijiCmd.py", line 121, in
main()
File "../KijijiCmd.py", line 53, in main
args.function(args)
File "../KijijiCmd.py", line 115, in nuke
api.login(args.username, args.password)
File "/home/oleg/git-hub/Kijiji-Repost-Headless/KijijiApi.py", line 90, in login
raise SignInException(resp.text)
KijijiApi.SignInException: Could not sign in.
Was working and login works, Do you have an idea what could be the cause?
Thanks,
I am getting this error when running generate_inf_file.py
$ python3.6 /root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/generate_inf_file.py
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: database is locked
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/generate_inf_file.py", line 7, in
from posting_category import *
File "/root/Kijiji-Repost/Kijiji-Repost-Headless-master/kijiji_repost_headless/posting_category.py", line 73, in
Base.metadata.create_all(engine)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/schema.py", line 3934, in create_all
tables=tables)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1929, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1538, in _run_visitor
**kwargs).traverse_single(element)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 733, in visit_metadata
_is_metadata_operation=True)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 767, in visit_table
include_foreign_key_constraints=include_foreign_key_constraints
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1002, in _execute_ddl
compiled
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: '\nCREATE TABLE "postingCategory" (\n\t_id INTEGER NOT NULL, \n\t"kijijiId" VARCHAR, \n\tname VARCHAR, \n\tPRIMARY KEY (_id)\n)\n\n']
See log below.
I just re-do the same command line over & over until it works.
➜ kijiji_repost_headless git:(master) ✗ python3 kijiji_cmd.py folder seadoo
401
Traceback (most recent call last):
File "kijiji_cmd.py", line 155, in <module>
main()
File "kijiji_cmd.py", line 48, in main
args.function(args)
File "kijiji_cmd.py", line 79, in post_folder
post_ad(args)
File "kijiji_cmd.py", line 88, in post_ad
api.post_ad_using_data(data, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 155, in post_ad_using_data
imageList = self.upload_image(image_upload_token, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 133, in upload_image
imageTree = json.loads(r.text)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
➜ kijiji_repost_headless git:(master) ✗ python3 kijiji_cmd.py folder seadoo
401
Traceback (most recent call last):
File "kijiji_cmd.py", line 155, in <module>
main()
File "kijiji_cmd.py", line 48, in main
args.function(args)
File "kijiji_cmd.py", line 79, in post_folder
post_ad(args)
File "kijiji_cmd.py", line 88, in post_ad
api.post_ad_using_data(data, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 155, in post_ad_using_data
imageList = self.upload_image(image_upload_token, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 133, in upload_image
imageTree = json.loads(r.text)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗ python3 kijiji_cmd.py folder seadoo
401
Traceback (most recent call last):
File "kijiji_cmd.py", line 155, in <module>
main()
File "kijiji_cmd.py", line 48, in main
args.function(args)
File "kijiji_cmd.py", line 79, in post_folder
post_ad(args)
File "kijiji_cmd.py", line 88, in post_ad
api.post_ad_using_data(data, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 155, in post_ad_using_data
imageList = self.upload_image(image_upload_token, imageFiles)
File "/Users/userremoved/Downloads/Kijiji-Repost-Headless/kijiji_repost_headless/kijiji_api.py", line 133, in upload_image
imageTree = json.loads(r.text)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗
➜ kijiji_repost_headless git:(master) ✗ python3 kijiji_cmd.py folder seadoo
{"status":"OK","normalUrl":"https://i.ebayimg.com/00/s/GRWTgrgGrg=/z/T$AWAF87HJ897hjh/$_2.JPG","thumbnailUrl":"https://i.ebayimg.com/00/s/GRWTgrgGrg=/z/AWAF87HJ897hjh/$_14.JPG"}
Image Upload success on try #1
{"status":"OK","thumbnailUrl":"https://i.ebayimg.com/00/s/OKgioGOIJg=/z/JF657tfJFgu54y/$_14.JPG","normalUrl":"https://i.ebayimg.com/00/s/OKgioGOIJg=/z/JF657tfJFgu54y/$_2.JPG"}
Image Upload success on try #1
➜ kijiji_repost_headless git:(master) ✗
Having a permission issue. Using windows 10, using administrative cmd prompt.
Any idea?
hello,
with command:
python kijiji_repost_headless repost_folder 1
I was able to repost but today I am getting this info after entering the command:
usage: kijiji_repost_headless [-h] [-u USERNAME] [-p PASSWORD]
{post,folder,repost_folder,show,delete,nuke,check_ad,repost,build_ad}
...
Post ads on Kijiji
positional arguments:
{post,folder,repost_folder,show,delete,nuke,check_ad,repost,build_ad}
sub-command help
post post a new ad
folder post ad from folder
repost_folder post ad from folder
show show currently listed ads
delete delete a listed ad
nuke delete all ads
check_ad check if ad is active
repost repost an existing ad
build_ad Generates the item.inf file for a new ad
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
username of your kijiji account
-p PASSWORD, --password PASSWORD
password of your kijiji account
Any ideas please?
The repost deletes the previous post and says "Existing ad deleted before reposting" but then it just does nothing and hangs on this message forever.
UPD: I just checked the code and this is actually intentional. It looks like there is a 3 minute (180 second) wait before reposting. I think this needs to be documented in the message: "Existing ad deleted before reposting. Waiting 2 minutes before posting again"
UPD2: Actually, it says it deleted the ad even if there was no ad to delete... I wonder why
for some reason posting to this category does not work
how to recreate error:
generate item to go in sporting goods excersize > watersports
try to post item
example item.inf
postAdForm.geocodeLat=51.1254463
postAdForm.geocodeLng=-114.0734201
postAdForm.city=Calgary
postAdForm.addressCity=Calgary
postAdForm.province=AB
postAdForm.addressProvince=AB
postAdForm.postalCode=T3K 3V9
postAdForm.addressPostalCode=T3K 3V9
PostalLat=51.1254463
PostalLng=-114.0734201
categoryId=668
postAdForm.adType=OFFER
postAdForm.priceType=FIXED
postAdForm.priceAmount=10
postAdForm.attributeMap[forsaleby_s]=ownr
postAdForm.title=Scuba Gear
postAdForm.description=Scuba Gear good quality
postAdForm.locationId=1700199
locationLevel0=9003
featuresForm.topAdDuration=7
submitType=saveAndCheckout
imageCsv=scuba.jpg
https://www.pastiebin.com/5999e61b4346f
here is kijiji error output txt generated
I'm seeing a syntax error when I tried to generate a ad,
18:57:50->python generate_inf_file.py Traceback (most recent call last): File "generate_inf_file.py", line 7, in <module> from posting_category import * File "/Users/kbonthu/Kijiji-Repost-Headless/kijiji_repost_headless/posting_category.py", line 68 return {**leafCategory, **(get_category_map(session, newBranches, False))} ^ SyntaxError: invalid syntax
please delete
401 or not, sometimes repost fails even if images upload and all is reported ok. If there was a simple way to check if ad was reposted, verify ad name is posted?
if itemvariablename==showitemlisted
then quit
else
repost_folder item
?
cars also dont work, need to put proper model, see motorcycle issue
When trying to post an ad with & without folder i'm getting the following error:
I added in the forrentbyhousing_s/furnished_s/petsallowed_s required attributes, not sure what's causing this. I assume it has to do with the category as I did a test in another category & got the ad to post (repost however did not work afterwards - I'll deal with that issue if it comes up again once this is resolved).
I've included the contents of my inf file below, thank you so much.
postAdForm.geocodeLat=43.6381725
postAdForm.geocodeLng=-79.4129782
postAdForm.city=Toronto
postAdForm.province=ON
PostalLat=43.6381725
PostalLng=-79.4129782
categoryId=214
postAdForm.adType=OFFER
postAdForm.priceType=FIXED
postAdForm.priceAmount=1600
postAdForm.attributeMap[numberbathrooms_s]=10
postAdForm.attributeMap[forrentbyhousing_s]=ownr
postAdForm.attributeMap[furnished_s]=0
postAdForm.attributeMap[petsallowed_s]=0
postAdForm.title=1 & 2 Bedroom Condos For Rent!
postAdForm.description=Looking to live in a condo or loft? Send me a message with what you're looking for and I'll be happy to assist you in finding your next home.
postAdForm.locationId=1700273
locationLevel0=1700272
postAdForm.postalCode=M6K 3P9
featuresForm.topAdDuration=7
submitType=saveAndCheckout
imageCsv=tf.jpg,512.jpg,51.jpg,75.jpg,150.jpg,752.jpg,pool.jpg
I am looking at the following exception in your kijiji_api.py file:
class BannedException(KijijiApiException):
def __str__(self):
return "Could not post ad, this user is banned.\n"+super().__str__()
I constantly run into this exception.
I realize that this happens if session finds the following string in the response after posting:
There was an issue posting your ad, please contact Customer Service.
Even when I try to post manually using a web browser, I get the same issue.
Looks like I am banned.
Do you have any workaround for this? Is this temporary or permanent for my username? Any advise on how to avoid this in the future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.