Jump to page: 1 2
Thread overview
requests module generates " Can't parse uri '' "
Nov 08
cartland
Nov 08
cartland
Nov 08
cartland
Nov 08
ikod
Nov 09
cartland
Nov 09
cartland
Re: (SOLVED) requests module generates " Can't parse uri '' "
Nov 10
cartland
Nov 10
cartland
Nov 10
ikod
November 08
First time D use :)

After dub init, I used the example from https://code.dlang.org/packages/requests and ran "dub add requests"

When I run dub, I get

requests.uri.UriException@/home/cartland/.dub/packages/requests-1.0.9/requests/source/requests/uri.d(35): Can't parse uri ''

Full output on initial run:

Fetching vibe-core 1.7.0 (getting selected version)...
Fetching requests 1.0.9 (getting selected version)...
Fetching memutils 0.4.13 (getting selected version)...
Fetching taggedalgebraic 0.11.7 (getting selected version)...
Fetching vibe-d 0.8.6 (getting selected version)...
Fetching botan-math 1.0.3 (getting selected version)...
Fetching stdx-allocator 2.77.5 (getting selected version)...
Fetching botan 1.12.10 (getting selected version)...
Fetching diet-ng 1.6.0 (getting selected version)...
Fetching openssl 1.1.6+1.0.1g (getting selected version)...
Fetching cachetools 0.3.1 (getting selected version)...
Fetching eventcore 0.8.48 (getting selected version)...
Fetching mir-linux-kernel 1.0.1 (getting selected version)...
Fetching libevent 2.0.2+2.0.16 (getting selected version)...
Fetching libasync 0.8.4 (getting selected version)...
Performing "debug" build using /home/cartland/dlang/dmd-2.089.0/linux/bin64/dmd for x86_64.
cachetools 0.3.1: building configuration "library"...
requests 1.0.9: building configuration "std"...
x ~master: building configuration "application"...
Linking...
Running ./x
requests.uri.UriException@/home/cartland/.dub/packages/requests-1.0.9/requests/source/requests/uri.d(35): Can't parse uri ''
Program exited with code 1

November 08
On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
> When I run dub, I get

What was your main() code?

The error makes me think you might have just tried like get("") or something
November 08
On Friday, 8 November 2019 at 03:31:56 UTC, Adam D. Ruppe wrote:
> On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
>> When I run dub, I get
>
> What was your main() code?
>
> The error makes me think you might have just tried like get("") or something

import std.stdio;
import requests;

void main() {
    auto content = getContent("https://httpbin.org/get", queryParams("name", "any name", "age", 42));
    writeln(content);
}
November 08
On Friday, 8 November 2019 at 03:36:22 UTC, cartland wrote:
> * snip *

huh, idk, it works when I try that exact code in a fresh project

dub init
dub add requests
# edit source/app.d to have your contents
dub run

and it spat out the content...

are you behind a proxy or something maybe?
November 08
On Friday, 8 November 2019 at 03:43:52 UTC, Adam D. Ruppe wrote:
> On Friday, 8 November 2019 at 03:36:22 UTC, cartland wrote:
>> * snip *
>
> huh, idk, it works when I try that exact code in a fresh project
>> * snip *
> are you behind a proxy or something maybe?

Thanks for checking. I'm not behind a proxy. The firewall allows browsing to the url. Also tried older versions of requests with the same result. The same (similar) call works using std.net.curl.

I'm on Tumbleweed. I'll try it on MacOS. And also try a different network a bit later.
November 08
On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
> First time D use :)
>
> After dub init, I used the example from https://code.dlang.org/packages/requests and ran "dub add requests"
>
> [...]

If you still stuck with this problem, you can post new issue on github project page, I'll try to solve it.

https://github.com/ikod/dlang-requests
November 09
On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
> On Friday, 8 November 2019 at 03:29:41 UTC, cartland wrote:
>> First time D use :)
>>
>> After dub init, I used the example from https://code.dlang.org/packages/requests and ran "dub add requests"
>>
>> [...]
>
> If you still stuck with this problem, you can post new issue on github project page, I'll try to solve it.
>
> https://github.com/ikod/dlang-requests

Same on MacOS. Using dmd, ldc, or gdc. I'll raise an issue on https://github.com/ikod/dlang-requests.

Even this does it.

import requests;
void main() {
}
November 09
On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
> On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
> *snip*
> Even this does it.
>
> import requests;
> void main() {
> }

https://github.com/ikod/dlang-requests/issues/109
November 10
On Saturday, 9 November 2019 at 01:02:57 UTC, cartland wrote:
> On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
>> On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
>> *snip*
>> Even this does it.
>>
>> import requests;
>> void main() {
>> }
>
> https://github.com/ikod/dlang-requests/issues/109

Figured it out. See github issue. I had http_proxy env var set to blank. Worked when I unset it.
November 10
On Sunday, 10 November 2019 at 01:28:13 UTC, cartland wrote:
> On Saturday, 9 November 2019 at 01:02:57 UTC, cartland wrote:
>> On Saturday, 9 November 2019 at 00:53:13 UTC, cartland wrote:
>>> On Friday, 8 November 2019 at 17:01:07 UTC, ikod wrote:
>>> *snip*
>>> Even this does it.
>>>
>>> import requests;
>>> void main() {
>>> }
>>
>> https://github.com/ikod/dlang-requests/issues/109
>
> Figured it out. See github issue. I had http_proxy env var set to blank. Worked when I unset it.

PS. As a long time C (and C++, Java/script, C#) dev, I'm loving D. Very impressive so far.
« First   ‹ Prev
1 2