d-h.st (Dev-Host) command line tool

Search This thread

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
dev-host-cl
dev-host-cl is a python script that allows you to upload and manage files to http://d-h.st (Dev-Host) from a shell. It can be used anonymously or with your account's credentials.

Visit the Github repo for the full README and installation instructions.

Thanks for reporting any bugs you might find. Suggestions are welcome.
 
Last edited:

fabi280

Senior Member
Oct 20, 2010
347
365
Karlsruhe
I've got serious problems using this tool, doesn't matter if I use python2 or python3
It starts uploading at first, but when it reaches 100% this message comes:
Code:
[I]fabi280@fabiserv ~/dev-host-cl $ [/I]./devhost.py upload -u fabi280 -p password -pb 1 -f mako_pa_nightly ../paranoidandroid/out/target/product/mako/pa_mako-3.60-22JUN2013-000503.zip
Logging in...
Starting...

Method: upload9%
File_info:

Response: Error
Message: File code specified doesn't exist or your don't have permission to update it.
Filename: pa_mako-3.60-22JUN2013-000503.zip
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
I've got serious problems using this tool, doesn't matter if I use python2 or python3
It starts uploading at first, but when it reaches 100% this message comes:
Code:
[I]fabi280@fabiserv ~/dev-host-cl $ [/I]./devhost.py upload -u fabi280 -p password -pb 1 -f mako_pa_nightly ../paranoidandroid/out/target/product/mako/pa_mako-3.60-22JUN2013-000503.zip
Logging in...
Starting...

Method: upload9%
File_info:

Response: Error
Message: File code specified doesn't exist or your don't have permission to update it.
Filename: pa_mako-3.60-22JUN2013-000503.zip

You specified a wrong folder ID (that's the exact server's response BTW).
To check the folder's ID, go to that folder and check the URL. For example:
Code:
http://d-h.st/myfiles?fld_id=[u]18780[/u]#files
 
Last edited:

fabi280

Senior Member
Oct 20, 2010
347
365
Karlsruhe
You specified a wrong folder ID (that's the exact server's response BTW).
To check the folder's ID, go to that folder and check the URL. For example:
Code:
http://d-h.st/myfiles?fld_id=[u]18780[/u]#files

Thanks but this doesn't really work either:
Code:
[COLOR="green"]fabi280@fabiserv[/COLOR] [COLOR="blue"]~ $[/COLOR] devhost upload -u fabi280 -p password -pb 1 -f 19084 paranoidandroid/changelog.txt
Logging in...
Starting...

Method: upload
File_info:

Response: Error
Message: File code specified doesn't exist or your don't have permission to update it.
Filename: changelog.txt

But as you can see on my public link - the folder ID is correct: http://d-h.st/users/fabi280/?fld_id=19084#files (its even the same on myfiles: http://d-h.st/myfiles?fld_id=19084#files)

EDIT: Even anonymous uploading doesn't work for me:
Code:
[COLOR="green"]fabi280@fabiserv[/COLOR] [COLOR="blue"]~ $[/COLOR] devhost upload /home/fabi280/paranoidandroid/changelog.txt 
Starting...

Method: upload
File_info:

Response: Error
Message: File code specified doesn't exist or your don't have permission to update it.
Filename: changelog.txt
 
Last edited:
  • Like
Reactions: GermainZ

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805

fabi280

Senior Member
Oct 20, 2010
347
365
Karlsruhe
Can you try the latest python3 version, please? If it works, I'll update the py2 version ASAP.

This one works:
Code:
[COLOR="green"]fabi280@fabiserv[/COLOR] [COLOR="blue"]~ $[/COLOR] python3 dev-host-cl/devhost.py upload -u fabi280 -p password -pb 1 -f 19084 paranoidandroid/changelog.txt
Logging in...
Starting...

Method: upload
File_info:

Response: Success
File_code: Kva
Delete_id: n3XXh0h881
Folder_id: 19084
Server: fs1
Filename: changelog.txt
Description: None
Size: 161
Downloads: None
Virus_status: None
Created: 2013-06-22 13:36:50
Md5sum: 1dd4b3f04dc72f2d287f38da5bb97f19
Public: 1
Download_url: http://d-h.st/Kva
Direct_download_url: http://fs1.d-h.st/download/00XX2/Kva/changelog.txt
 

varun.chitre15

Inactive Recognized Developer
Oct 23, 2011
3,153
15,403
Sangli
Not much into python scripting but I have below error when I do devhost upload myfile

Code:
Traceback (most recent call last):
  File "./devhost.py", line 24, in 
    from requests import session
ImportError: No module named requests
 
Last edited:
  • Like
Reactions: Benjilo777

zipsnet

Senior Member
Dec 22, 2010
438
845
Sunny Florida
Hello GermainZ,

Incredible script, thank you very much, quick question, I'm trying the create a folder to then upload a file into that folder on the fly ,any better way to do the following?


---- SNIP ------
#!/bin/bash

date=`date +%Y%m%d-%H%M`

uploadto=`devhost -u username -p password folder-create $date -f 22655|grep Id:|cut -d: -f2`
devhost -u username -p password upload -f $uploadto /tmp/Changelog.txt


---- END SNIP ------------------------


Thank You.
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
Hello GermainZ,

Incredible script, thank you very much, quick question, I'm trying the create a folder to then upload a file into that folder on the fly ,any better way to do the following?


---- SNIP ------
#!/bin/bash

date=`date +%Y%m%d-%H%M`

uploadto=`devhost -u username -p password folder-create $date -f 22655|grep Id:|cut -d: -f2`
devhost -u username -p password upload -f $uploadto /tmp/Changelog.txt


---- END SNIP ------------------------


Thank You.

Looks good, although you always want to quote your variables when using them. Also, using $() instead of `` is clearer.
Code:
#!/bin/bash

date=$(date +%Y%m%d-%H%M)

uploadto="$(devhost -u username  -p password  folder-create "$date" -f 22655 | grep Id: | cut -d: -f2)"
devhost -u username -p password  upload  -f  "$uploadto" /tmp/Changelog.txt
 
  • Like
Reactions: zipsnet

CNexus

Senior Member
May 17, 2012
9,010
14,000
~/android
Google Pixel 7
Wow. Excellent script you got here.

Just used the Python 2 version and it worked flawlessly. Love the "direct download link" output too, makes it easy to pipe into another command and compile a list of download links :)
 

ziddey

Senior Member
Aug 26, 2007
1,905
1,613
Thank you for this! Now to figure out how to write a bash script to post the download link to a thread here
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
Wow. Excellent script you got here.

Just used the Python 2 version and it worked flawlessly. Love the "direct download link" output too, makes it easy to pipe into another command and compile a list of download links :)
Dev-Host is returning that, the script is only outputting the info nicely. :p
Thank you for this! Now to figure out how to write a bash script to post the download link to a thread here
I'd try Googling "curl post vbulletin", someone probably tried something similar.
 

nolinuxnoparty

Senior Member
Jun 20, 2013
606
987
XDA
@GermainZ: Can you put something like folder-enter [folder name]. and multiple actions?

I.E: devhost -u user -p userpass folder-create rom; folder-enter rom; upload rom.zip? Something like that? (PS: Just giving suggestions :D )
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
@GermainZ: Can you put something like folder-enter [folder name]. and multiple actions?

I.E: devhost -u user -p userpass folder-create rom; folder-enter rom; upload rom.zip? Something like that? (PS: Just giving suggestions :D )

I suppose I could offer some switch to save the token and/or reuse an existing token. So basically, you could do this instead of logging in each time:
Code:
devhost -u user -p userpass --save-token folder-create rom //since the ID is returned here, you can get it yourself to use it next, either manually or with a simple shell script
devhost --use-token upload -f <ID>

I don't think it's possible to support multiple commands without writing my own parser from scratch, but I'll take a quick look. Don't hold your breath, tho.
 
  • Like
Reactions: nolinuxnoparty

DooMLoRD

Inactive Recognized Developer
Jul 27, 2010
13,187
39,710
Pune
@GermainZ

great work with this script!

I had a request, is it possible to modify the script to take backup of my entire account? i am planning to migrate to different server so want to backup all files from my dev-host account
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,170
8,805
@GermainZ

great work with this script!

I had a request, is it possible to modify the script to take backup of my entire account? i am planning to migrate to different server so want to backup all files from my dev-host account

You can write a script that uses this one as a library to do that. A simple example to print a tree of your files/folders (python3):
Code:
http://ix.io/89W
Place it in the same directory devhost.py is in (or copy devhost.py to a new directory and place this with it). Replace "username" and "password" (line 5) by your username/password, and run it.

If it works fine for you, I can modify it to download the files/create folders as well.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    dev-host-cl
    dev-host-cl is a python script that allows you to upload and manage files to http://d-h.st (Dev-Host) from a shell. It can be used anonymously or with your account's credentials.

    Visit the Github repo for the full README and installation instructions.

    Thanks for reporting any bugs you might find. Suggestions are welcome.
    5
    Contacted DevHost and the API is back up now.
    3
    DevHost apparently removed their API documentation (previously at http://d-h.st/api) — there's absolutely no mention of an API on their website anymore. I can't guarantee this script will keep working (it apparently doesn't anymore for non anonymous uploads, as trying to authenticate through the API now returns a "File Not Found" page).
    2
    I've got serious problems using this tool, doesn't matter if I use python2 or python3
    It starts uploading at first, but when it reaches 100% this message comes:
    Code:
    [I]fabi280@fabiserv ~/dev-host-cl $ [/I]./devhost.py upload -u fabi280 -p password -pb 1 -f mako_pa_nightly ../paranoidandroid/out/target/product/mako/pa_mako-3.60-22JUN2013-000503.zip
    Logging in...
    Starting...
    
    Method: upload9%
    File_info:
    
    Response: Error
    Message: File code specified doesn't exist or your don't have permission to update it.
    Filename: pa_mako-3.60-22JUN2013-000503.zip

    You specified a wrong folder ID (that's the exact server's response BTW).
    To check the folder's ID, go to that folder and check the URL. For example:
    Code:
    http://d-h.st/myfiles?fld_id=[u]18780[/u]#files
    2
    After uploaded I get this errors :confused:
    DevHost's fault.



    I've updated the script to print the raw response if an error occurs. Update your version (actually, it would be a good idea to check every now and then and update when necessary.)